<template>
  <div class="app-container">


    <el-card  shadow="never" :body-style="{ padding: '5px' }">
      <div >
          <div >
            <Find
              :OriginalFilter="{ static: true }"
              style="margin-left: 15px"
              :searchImg="false"
              :formList="formList1"
              @Launchform="Launchform1"
              @findClicked="findClicked"
            />  
            <div slot="header" class="f16"></div>

            <div style="width: 100%;margin-top: 15px;">
              <Table
                @currentRow="currentRow1"
                @currentRow1="currentRow13"
                :tableHeader="tableHeader"
                :tableData="TypeQueryMethodsTableDateList"
                :TableHeight="110"
                :outTableHeight="100"
                :isLoading="isLoading11"
                @download="download"
              />
              <PageModule
                :PageData="{ total: totalTk, buttonS: true, pageSizeShow: true }"
                :layout="'prev, pager'"
                @pageSizeChange="handleSizeChangeTk"
                @pageChange="handleCurrentChangeTk"
              />
            </div>

              <el-dialog :close-on-click-modal="false" v-model="AllSizeNo128" title="" :direction="'ttb'" size="small" :with-header="false" width="70%">
                
                  
                      <div style="width: 100%; margin-left: 10px; border-radius: 0px 0px 0px 0px; border: 1px solid #dcdfe6">
                        <Find
                          style="margin-left: 10px"
                          @Launchform="Launchform30"
                          :OriginalFilter="{ static: true }"
                          :searchImg="false"
                          :formList="formList2"
                          @findClicked="findClicked1"
                        />
                        <div >
                                <span style="font-weight: 600; margin-bottom: 15px">型体颜色材料输入</span>
                              </div>

                              <Table
                                @toBottom="toBottom"
                                @toUp="toUp"
                                @inputChange="inputChange20"
                                @emitSelectValue="selectValChange"
                                @selectListShow="selectListShow"
                                @selectList="selectedList"
                                :selection="true"
                                :isLoading="loading"
                                :tableHeader="tableHeader3"
                                :tableData="TypeColorDataQueryMethodsInterfaceTableDateList"
                                :TableHeight="91"
                                :outTableHeight="5"
                                @currentRow="currentRow3"
                                @currentRow1="currentRow20"
                              />

                          
                      </div>
                      <div >
                      
                         

                          </div>
              </el-dialog>



            <!-- <div style="width: 100%"> -->
              <!-- <Table
                :isLoading="isLoading15"
                @currentRow="currentRow2"
                :tableHeader="tableHeader2"
                :tableData="ColorCodePictureMethodsParmsTableDateList.list"
                :TableHeight="40"
                :outTableHeight="150"
              /> -->
              <!-- <PageModule :PageData="{ total: total, buttonS: true, pageSizeShow: true }" :layout="'prev, pager'"
              @pageSizeChange="handleSizeChange" @pageChange="handleCurrentChange" /> -->
              <!-- <div style="width: 50%;height: 100px;">
                <img :src="image" alt="">
              </div> -->

              <!-- <div class="demo-image__preview"> -->
                <!-- <el-image
                  style="width: 100%; height: 150px"
                  :src="image"
                  :preview-src-list="imgList"
                  :initial-index="4"
                  fit="cover"
                  hide-on-click-modal
                /> -->
              <!-- </div> -->
            <!-- </div> -->
          </div>
        </div>


    </el-card>





    <!-- 新增数据 -->
    <el-dialog :close-on-click-modal="false" v-model="AllSizeNo126" title="" :direction="'ttb'" size="small" :with-header="false" width="30%">
      <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="型体">
        <el-input @change="RdTypeBodyFileOrderListMethods" v-model="RdTypeBodyFileOrderListParms.styleNo" placeholder="请输入型体" />
      </el-form-item>
      <el-form-item label="型体颜色">
        <!-- <el-input @change="RdTypeBodyFileOrderListMethods" v-model="RdTypeBodyFileOrderListParms.styleColor" placeholder="请输入型体颜色" /> -->
        <el-select v-model="RdTypeBodyFileAddMethodsParmsParms.styleColor" placeholder="请选择颜色代码 " size="default" style="width: 240px">
          <el-option
            v-for="(item,index) in RdTypeBodyFileCodeTableDat"
            :key="index"
            :label="item.styleColor"
            :value="item.styleColor"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="颜色代码">
        <el-input v-model="RdTypeBodyFileAddMethodsParmsParms.colorCode" placeholder="请输入颜色代码" />
      </el-form-item>

      <el-form-item label="基本码">
        <el-input v-model="RdTypeBodyFileAddMethodsParmsParms.baseSize" placeholder="请输入基本码" />
      </el-form-item>
      <el-form-item label="备注">
        <el-input v-model="RdTypeBodyFileAddMethodsParmsParms.remark" placeholder="请输入备注" />
      </el-form-item>
      <el-form-item label="订单号">

        <el-select v-model="RdTypeBodyFileAddMethodsParmsParms.orderId" placeholder="请选订单号 " size="default" style="width: 240px">
          <el-option
            v-for="(item,index) in RdTypeBodyFileCodeTableDat"
            :key="index"
            :label="item.orderId"
            :value="item.orderId"
          />
        </el-select>
      </el-form-item>

        
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="RdTypeBodyFileAddMethods">确 定</el-button>
        <el-button @click="AllSizeNo126 = false">取 消</el-button>
      </div>
    </template>
    </el-dialog>

    <!-- BOM修改 -->
    <el-dialog :close-on-click-modal="false" v-model="AllSizeNo127" title="BOM修改" :direction="'ttb'" size="small" :with-header="false" width="30%">
      <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="型体">
        <el-input :disabled="true" v-model="RdTypeBodyFileEditParms.styleNo" placeholder="请输入型体" />
      </el-form-item>
      <el-form-item  label="型体颜色">
        <el-input :disabled="true"  v-model="RdTypeBodyFileEditParms.styleColor" placeholder="请输入型体颜色" />
      </el-form-item>
      <el-form-item label="颜色代码">
        <el-input v-model="RdTypeBodyFileEditParms.colorCode" placeholder="请输入颜色代码" />
      </el-form-item>
      <el-form-item label="基本码">
        <el-input v-model="RdTypeBodyFileEditParms.baseSize" placeholder="请输入基本码" />
      </el-form-item>
      <el-form-item label="备注">
        <el-input v-model="RdTypeBodyFileEditParms.remark" placeholder="请输入备注" />
      </el-form-item>
      <el-form-item  label="订单号">

        <el-select :disabled="true" v-model="RdTypeBodyFileEditParms.orderId" placeholder="请选订单号 " size="default" style="width: 240px">
          <el-option
            v-for="(item,index) in RdTypeBodyFileCodeTableDat1"
            :key="index"
            :label="item.orderId"
            :value="item.orderId"
          />
        </el-select>
      </el-form-item>

      <el-form-item  label="图片" style="width: 46%;">
        <el-upload
        :disabled="true"
            class="avatar-uploader111"
            action="/api/file/oss/upload"
            :show-file-list="false"
            :on-success="handleAvatarSuccess1"
            :headers="{ Authorization: tokenList }"
          >
    <img v-if="imageUrl" :src="imageUrl" class="avatar111" />
    <el-icon v-else class="avatar-uploader-icon111"><Plus /></el-icon>
  </el-upload>
      </el-form-item>

        
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="RdTypeBodyFileEditMethods">确 定</el-button>
        <el-button @click="AllSizeNo127 = false">取 消</el-button>
      </div>
    </template>
    </el-dialog>





    <el-card v-if="false" shadow="never" :body-style="{ padding: '5px' }">
      <div style="display: flex; align-items: stretch">
        <div style="width: 17.5%">
          <div style="width: 95%; border-radius: 0px 0px 0px 0px; border: 1px solid #dcdfe6">
            <Find
              @inputDBclick="inputDBclick"
              :OriginalFilter="{ static: true }"
              style="margin-left: 15px"
              :searchImg="false"
              :formList="formList1"
              @Launchform="Launchform1"
              @findClicked="findClicked"
            />
            <div slot="header" class="f16"></div>

            <div style="width: 100%">
              <Table
                @currentRow="currentRow1"
                :tableHeader="tableHeader"
                :tableData="TypeQueryMethodsTableDateList"
                :TableHeight="50"
                :outTableHeight="150"
                :isLoading="isLoading11"
              />
              <PageModule
                :PageData="{ total: totalTk, buttonS: true, pageSizeShow: true }"
                :layout="'prev, pager'"
                @pageSizeChange="handleSizeChangeTk"
                @pageChange="handleCurrentChangeTk"
              />
            </div>

            <div style="width: 100%">
              <Table
                :isLoading="isLoading15"
                @currentRow="currentRow2"
                :tableHeader="tableHeader2"
                :tableData="ColorCodePictureMethodsParmsTableDateList.list"
                :TableHeight="40"
                :outTableHeight="150"
              />
              <!-- <PageModule :PageData="{ total: total, buttonS: true, pageSizeShow: true }" :layout="'prev, pager'"
              @pageSizeChange="handleSizeChange" @pageChange="handleCurrentChange" /> -->
              <!-- <div style="width: 50%;height: 100px;">
                <img :src="image" alt="">
              </div> -->

              <div class="demo-image__preview">
                <el-image
                  style="width: 100%; height: 150px"
                  :src="image"
                  :preview-src-list="imgList"
                  :initial-index="4"
                  fit="cover"
                  hide-on-click-modal
                />
              </div>
            </div>
          </div>
        </div>
        <div style="width: 83%; display: flex; height: 110px; flex-wrap: wrap">
          <div style="width: 18%; border-radius: 0px 0px 0px 0px; border: 1px solid #dcdfe6">
            <Find
              style="margin-left: 10px"
              @inputDBclick="inputDBclick"
              :OriginalFilter="{ static: true }"
              :searchImg="false"
              :formList="formListLeft"
              @findClicked="findClicked"
            />
          </div>
          <div style="width: 70%; margin-left: 10px; border-radius: 0px 0px 0px 0px; border: 1px solid #dcdfe6">
            <Find
              style="margin-left: 10px"
              @Launchform="Launchform30"
              :OriginalFilter="{ static: true }"
              :searchImg="false"
              :formList="formList2"
              @findClicked="findClicked1"
            />
          </div>
          <div style="width: 100%" class="mt24">
            <el-card shadow="never" :body-style="{ padding: '5px' }">
              <div style="display: flex">
                <div style="width: 100%">
                  <div slot="header" class="f16">
                    <span style="font-weight: 600; margin-bottom: 15px">型体颜色材料输入</span>
                  </div>
                  <HeTable
                    v-if="true"
                    @toBottom="toBottom"
                    @toUp="toUp"
                    @inputChange="inputChange20"
                    @emitSelectValue="selectValChange"
                    @selectListShow="selectListShow"
                    @selectList="selectedList"
                    :selection="true"
                    :isLoading="loading"
                    :tableHeader="tableHeader3"
                    :tableData="TypeColorDataQueryMethodsInterfaceTableDateList"
                    :TableHeight="100"
                    :outTableHeight="5"
                    @currentRow="currentRow3"
                    @currentRow1="currentRow20"
                  />

                  <Table
                    v-else
                    @toBottom="toBottom"
                    @toUp="toUp"
                    @inputChange="inputChange20"
                    @emitSelectValue="selectValChange"
                    @selectListShow="selectListShow"
                    @selectList="selectedList"
                    :selection="true"
                    :isLoading="loading"
                    :tableHeader="tableHeader3"
                    :tableData="TypeColorDataQueryMethodsInterfaceTableDateList"
                    :TableHeight="100"
                    :outTableHeight="5"
                    @currentRow="currentRow3"
                    @currentRow1="currentRow20"
                  />

              
                </div>
              </div>
            </el-card>
          </div>
        </div>
      </div>
    </el-card>

  

    <!-- 选择材料 -->
    <el-dialog :close-on-click-modal="false" v-model="dialogVisible2" title="选择材料" width="50%" class="dialog pb0">
      <Find :OriginalFilter="{ static: true }" :searchImg="false" :formList="formList6" @Launchform="Launchform7" @findClicked="findClicked6" />
      <h1 style="color: red">正式材料</h1>
      <Table
        @currentRow="currentRow7"
        :tableHeader="tableHeader12"
        :tableData="FormalMaterialsAndMethodsForDevelopingTableDateList.officialMaterials.adhesiveMaterialList"
        :TableHeight="35"
        :outTableHeight="230"
      />
      <PageModule
        :PageData="{ total: totalExploit, buttonS: true, pageSizeShow: true }"
        @pageSizeChange="handleSizeChangeExploit"
        @pageChange="handleCurrentChangeExploit"
      />
      <div style="margin: auto; width: 20%">
        <el-button type="primary" size="default" @click="SelectTheCurrentRowToInsertMethods">选择当前行正式材料到用量表</el-button>
      </div>

      <h1 style="color: red">开发材料</h1>
      <Table
        @currentRow1="currentRow8"
        :tableHeader="tableHeader13"
        :tableData="FormalMaterialsAndMethodsForDevelopingTableDateList.developmentMaterials.developmentMaterialsList"
        :TableHeight="35"
        :outTableHeight="230"
      />
      <PageModule
        :PageData="{ total: totalofficial, buttonS: true, pageSizeShow: true }"
        @pageSizeChange="handleSizeChangeofficial"
        @pageChange="handleCurrentChangeofficial"
      />
      <div style="margin: auto; width: 20%">
        <el-button type="primary" size="default" @click="ProductionOfOfficialMaterialsMethods">生产正式材料并选择到用量表</el-button>
      </div>
      <div style="width: 30%; display: flex; margin-top: 30px">
        <p>
          <el-form-item label="材料名称" style="font-size: 15px; height: 40px; align-items: center; margin-left: 20px">
            <el-input
              type="textarea"
              :disabled="true"
              v-model="ProductionOfOfficialMaterialsMethodsParms.mtlName"
              style="width: 410px; height: 40px; margin-top: 5px"
            />
          </el-form-item>
        </p>

        <div style="margin-left: 50px; margin-top: -30px">
          <el-form-item label="材料颜色" style="font-size: 15px; height: 40px; align-items: center; margin-left: -10px">
            <el-input
              @dblclick="dbClickListColor"
              v-model="ProductionOfOfficialMaterialsMethodsParms.mtlColor"
              style="width: 400px; height: 40px; margin-top: 5px"
            />
          </el-form-item>
          <div style="display: flex">
            <el-form-item label="规格" style="font-size: 15px; height: 40px; align-items: center; margin-left: -10px">
              <el-input
                :disabled="true"
                v-model="ProductionOfOfficialMaterialsMethodsParms.mtlSpec"
                style="width: 80px; height: 40px; margin-top: 5px; margin-right: -10px"
              />
            </el-form-item>

            <el-form-item label="单位" style="font-size: 15px; height: 40px; align-items: center; margin-left: 20px">
              <el-input
                :disabled="true"
                v-model="ProductionOfOfficialMaterialsMethodsParms.mtlUnit"
                style="width: 80px; height: 40px; margin-top: 5px; margin-right: -10px"
              />
            </el-form-item>

            <el-form-item label="供应商" style="font-size: 15px; height: 40px; align-items: center; margin-left: 20px">
              <el-input
                :disabled="true"
                v-model="ProductionOfOfficialMaterialsMethodsParms.vendor"
                style="width: 80px; height: 40px; margin-top: 5px; margin-right: -10px"
              />
            </el-form-item>
          </div>
        </div>
      </div>
    </el-dialog>

    <el-drawer v-model="drawer3" :direction="'ttb'" size="small" :with-header="false">
      <span @click="drawer3 = false" style="float: right; cursor: pointer; color: rgb(7, 7, 7)">X</span>
      <h1>查询条件</h1>
      <Find :OriginalFilter="{ static: true }" :searchImg="false" :formList="formList3" @Launchform="Launchform5" @findClicked="findClicked10" />
      <div style="display: flex; margin-top: 10px">
        <div style="width: 90%">
          <h1>型体颜色BOM查询</h1>
          <Table
            @currentRow="currentRow5"
            :tableHeader="tableHeader8"
            :tableData="UsageDetailQueryMethodsTableDateList.list"
            :TableHeight="100"
            :outTableHeight="80"
          />
          <PageModule
            :PageData="{ total: totalList, buttonS: true, pageSizeShow: true }"
            @pageSizeChange="handleSizeChangeList"
            @pageChange="handleCurrentChangeList"
          />
        </div>
        <div style="width: 10%; margin-left: 10px">
          <h1>全码用量资料</h1>
          <Table :tableHeader="tableHeader9" :tableData="AllListMethodsTableDateList" :TableHeight="100" :outTableHeight="80" />
        </div>
      </div>
    </el-drawer>

    <el-drawer v-model="drawer5" :direction="'ttb'" size="small" :with-header="false">
      <Table :tableHeader="tableHeader10" :tableData="UsageChangeQueryMethodsTableDateList.list" :TableHeight="100" :outTableHeight="80" />
      <PageModule
        :PageData="{ total: totalA, buttonS: true, pageSizeShow: true }"
        @pageSizeChange="handleSizeChangeA"
        @pageChange="handleCurrentChangeA"
      />
    </el-drawer>

    <!-- 复制资料 -->
    <el-dialog :close-on-click-modal="false" v-model="dialogVisible1" title="复制资料" width="50%" class="dialog pb0">
      <div style="display: flex">
        <div style="width: 30%">
          <el-form-item label="原型体" style="font-size: 15px; height: 40px; display: flex; align-items: center; margin-left: 20px">
            <el-input v-model="CopyDataMethodsPamrs.styleNo" style="width: 200px; height: 40px; margin-top: 5px" :disabled="true" />
          </el-form-item>

          <el-form-item label="原颜色" style="font-size: 15px; height: 40px; display: flex; align-items: center; margin-left: 20px">
            <el-input v-model="CopyDataMethodsPamrs.styleColor" style="width: 100px; height: 40px; margin-top: 5px" :disabled="true" />
          </el-form-item>

          <el-form-item label="订单号" style="font-size: 15px; height: 40px; display: flex; align-items: center; margin-left: -10px">
            <el-input
              v-model="CopyDataMethodsPamrs.orderId"
              style="width: 230px; height: 40px; margin-top: 5px; margin-right: -10px"
              :disabled="true"
            />
          </el-form-item>
        </div>

        <div style="width: 30%; margin-left: 100px">
          <el-form-item label="新型体" style="font-size: 15px; height: 40px; display: flex; align-items: center; margin-left: 20px">
            <el-input @dblclick="doubeList" v-model="CopyDataMethodsPamrs.newStyle" style="width: 200px; height: 40px; margin-top: 5px" />
          </el-form-item>

          <el-form-item label="新颜色" style="font-size: 15px; height: 40px; display: flex; align-items: center; margin-left: 20px">
            <el-input @dblclick="inputDBclick1" v-model="CopyDataMethodsPamrs.newColor" style="width: 100px; height: 40px; margin-top: 5px" />
          </el-form-item>

          <el-form-item label="订单号" style="font-size: 15px; height: 40px; display: flex; align-items: center; margin-left: -10px">
            <el-input v-model="CopyDataMethodsPamrs.newOrderId" style="width: 230px; height: 40px; margin-top: 5px; margin-right: -10px" />
          </el-form-item>
        </div>

        <div style="width: 5%; margin-left: 30px">
          <el-radio-group style="display: flex" v-model="CopyDataMethodsPamrs.wantColor">
            <el-radio label="0" size="large">要颜色</el-radio>
            <el-radio label="1" size="large">不要颜色</el-radio>
          </el-radio-group>
        </div>
      </div>
      <Find :OriginalFilter="{ static: true }" :searchImg="false" @findClicked="findClicked5" :formList="formList5" @Launchform="Launchform" />
    </el-dialog>

    <!-- 颜色弹框 -->
    <el-drawer v-model="drawer" :direction="'ttb'" size="small" :with-header="false">
      <span @click="drawer = false" style="float: right; cursor: pointer; color: rgb(7, 7, 7)">X</span>
      <Find :OriginalFilter="{ static: true }" :searchImg="false" :formList="formList7" @Launchform="Launchform8" @findClicked="findData1" />
      <h5 style="font-size: 16px; margin-top: 12px">颜色明细</h5>
      <Table
        style="width: 60%"
        :tableData="ColorAcquisitionTableDateList.colorSystemList"
        :tableHeader="tableHeader15"
        :TableHeight="80"
        :isLoading="isLoading3"
        @currentRow1="currentRowToclk"
      />
      <PageModule
        style="width: 60%"
        :PageData="{ buttonS: true, total: totalKlt, pageSizeShow: true }"
        @pageChange="handleSizeChange2"
        @pageSizeChange="handleCurrentChange2"
      />
    </el-drawer>

    <!-- 贴合材料处理 -->
    <el-dialog :close-on-click-modal="false" v-model="dialogVisible3" title="贴合材料处理" width="50%" class="dialog pb0">
      <Find :OriginalFilter="{ static: true }" :searchImg="false" :formList="formList10" @findClicked="findData" @Launchform="Launchform11" />
      <div>
        <h1>贴合材料建档</h1>
        <Table
          @inputChange="confirmChange5"
          @currentRow="currentRow"
          :isLoading="isLoading2"
          :tableHeader="tableHeader17"
          :tableData="MethodOfBondingMaterialTableDateList"
          :TableHeight="20"
          :outTableHeight="210"
          @currentRow1="currentRow15"
          @selectValChange="confirmChange5"
          @checkboxChange="confirmChange5"
        />

        <div style="display: flex">
          <el-form-item label="材料名称" style="font-size: 15px; height: 40px; display: flex; align-items: center">
            <el-tooltip :content="InputDateList.input1" placement="top">
              <el-input v-model="InputDateList.input1" style="width: 303px; height: 40px; margin-top: 5px" :disabled="true" />
            </el-tooltip>
          </el-form-item>

          <el-form-item label="材料颜色" style="font-size: 15px; height: 40px; display: flex; align-items: center; margin-left: 10px">
            <el-tooltip :content="InputDateList.input2" placement="top">
              <el-input v-model="InputDateList.input2" style="width: 100px; height: 40px; margin-top: 5px" :disabled="true" />
            </el-tooltip>
          </el-form-item>

          <el-form-item label="规格" style="font-size: 15px; height: 40px; display: flex; align-items: center; margin-left: 10px">
            <el-input v-model="InputDateList.input3" style="width: 100px; height: 40px; margin-top: 5px" />
          </el-form-item>

          <el-form-item label="单位" style="font-size: 15px; height: 15px; margin-left: 30px;">
            <el-select v-model="InputDateList.input4"  placeholder="选择框" size="large">
              <el-option v-for="item in options" :key="item.mtlUnit" :label="item.mtlUnit" :value="item.mtlUnit" />
            </el-select>
          </el-form-item>
        </div>
      </div>

      <h1 style="color: red">正式材料</h1>
      <Table
        @currentRow="currentRow18"
        @currentRow1="currentRow17"
        :tableHeader="tableHeader12"
        :tableData="FormalMaterialsAndMethodsForDevelopingTableDateList.officialMaterials.adhesiveMaterialList"
        :TableHeight="30"
        :outTableHeight="230"
      />
      <PageModule
        :PageData="{ total: totalExploit, buttonS: true, pageSizeShow: true }"
        @pageSizeChange="handleSizeChangeExploit"
        @pageChange="handleCurrentChangeExploit"
      />

      <h1 style="color: red">开发材料</h1>
      <Table
        @currentRow="currentRow18"
        @currentRow1="currentRow23"
        :tableHeader="tableHeader13"
        :tableData="FormalMaterialsAndMethodsForDevelopingTableDateList.developmentMaterials.developmentMaterialsList"
        :TableHeight="30"
        :outTableHeight="230"
      />
      <PageModule
        :PageData="{ total: totalofficial, buttonS: true, pageSizeShow: true }"
        @pageSizeChange="handleSizeChangeofficial"
        @pageChange="handleCurrentChangeofficial"
      />
    </el-dialog>

    <!-- 复制用量 -->
    <el-dialog :close-on-click-modal="false" v-model="dialogVisible5" title="复制用量" width="30%" class="dialog pb0">
      <div>
        <Find :OriginalFilter="{ static: true }" :searchImg="false" :formList="formList8" @Launchform="Launchform10" />
        <div style="width: 70%; margin-top: 20px">
          <Table
            @selectList="selectedList12"
            :selection="true"
            :tableHeader="tableHeader16"
            :tableData="ReplicationVolumeQueryTableDateList.list"
            :TableHeight="40"
            :outTableHeight="230"
          />
          <PageModule
            :PageData="{ total: totalActiveList, buttonS: true, pageSizeShow: true }"
            :layout="'prev, pager'"
            @pageSizeChange="handleSizeChangeTkList"
            @pageChange="handleCurrentChangeTkList"
          />
        </div>
        <h1 style="color: #0000ff">把当前型体颜色用量复制到以以上打勾型体颜色</h1>
        <div style="width: 30px; margin: auto; margin-top: 20px">
          <el-button type="primary" size="default" @click="ReplicationDosageMethods">复制</el-button>
        </div>
      </div>
    </el-dialog>

    <!-- 取型体弹窗 -->
    <el-drawer v-model="drawer10" :direction="'ttb'" size="small" :with-header="false">
      <span @click="drawer10 = false" style="float: right; cursor: pointer; color: rgb(7, 7, 7)">X</span>
      <Find :OriginalFilter="{ static: true }" :searchImg="false" :formList="formList7" @Launchform="Launchform8" @findClicked="findData1" />
      <h5 style="font-size: 16px; margin-top: 12px">颜色明细</h5>
      <Table
        style="width: 60%"
        :tableData="ColorAcquisitionTableDateList.colorSystemList"
        :tableHeader="tableHeader15"
        :TableHeight="80"
        :isLoading="isLoading3"
        @currentRow1="currentRowToclk15"
      />
      <PageModule
        style="width: 60%"
        :PageData="{ buttonS: true, total: totalKlt, pageSizeShow: true }"
        @pageChange="handleSizeChange2"
        @pageSizeChange="handleCurrentChange2"
      />
    </el-drawer>

    <el-dialog :close-on-click-modal="false" v-model="dialogVisible" :direction="'ttb'" size="small" :with-header="false">
      <Table @download="download5" @inputChange="inputChange" class="widthInputTable" :tableData="PrecautionsFileMethodsParmsDateList" :tableHeader="tableHeader19" :TableHeight="110" />
    
    </el-dialog>

    <!-- 全码用量资料明细 -->
    <el-dialog :close-on-click-modal="false" v-model="AllSizeNo" :direction="'ttb'" size="small" :with-header="false" width="30%">
      <el-button type="primary" size="default" @click="addSize">增加全码用量资料</el-button>
      <el-button type="primary" size="default" @click="deleteSizeNo">删除全码用量</el-button>
      <el-button type="primary" size="default" @click="ubdatesizeNo">更新全码用量</el-button>

      <div style="width: 80%; margin-left: 5px; margin: auto; margin-top: 15px">
        <div slot="header" class="f16">
          <span style="font-weight: 600">全码用量资料</span>
        </div>
        <Table
          @currentRow="currentRow10"
          :isLoading="loading2"
          :tableHeader="tableHeader7"
          :tableData="FullCodeUsageDataMethodsTableDateLsit"
          :TableHeight="100"
          :outTableHeight="80"
        />
      </div>
    </el-dialog>

    <!-- 全码用量资料明细 -->
    <el-dialog :close-on-click-modal="false" v-model="AllSizeNo1" :direction="'ttb'" size="small" :with-header="false" width="30%">
      <Find :OriginalFilter="{ static: true }" :searchImg="false" :formList="formList15" @Launchform="Launchform20" @findClicked="findClicked20" />
    </el-dialog>

    <!-- 全码用量资料明细 -->
    <el-dialog :close-on-click-modal="false" v-model="AllSizeNo12" :direction="'ttb'" size="small" :with-header="false" width="30%">
      <Table
        @currentRow1="currentRow25"
        :isLoading="loading2"
        :tableHeader="tableHeaderStyleNo"
        :tableData="FullCodeUsageDataMethodsTableDateLsi1t"
        :TableHeight="100"
        :outTableHeight="80"
      />
    </el-dialog>

    <!-- 全码用量资料明细 -->
    <el-dialog :close-on-click-modal="false" v-model="AllSizeNo123" :direction="'ttb'" size="small" :with-header="false" width="30%">
      <Table
        @currentRow1="currentRow30"
        :tableHeader="tableHeader20"
        :tableData="TypeQueryMethodsTableDateList"
        :TableHeight="50"
        :outTableHeight="150"
        :isLoading="isLoading11"
      />
    </el-dialog>

    <!-- 全码用量资料明细 -->
    <el-dialog :close-on-click-modal="false" v-model="AllSizeNo125" :direction="'ttb'" size="small" :with-header="false" width="30%">
      <Table
        @currentRow1="currentRow26"
        :isLoading="loading2"
        :tableHeader="tableHeaderStyleNo1"
        :tableData="FullCodeUsageDataMethodsTableDateLsi1t1"
        :TableHeight="100"
        :outTableHeight="80"
      />
    </el-dialog>

        <!-- 部位弹框 -->
    <el-dialog :close-on-click-modal="false" v-model="AllSizeNo130" :direction="'ttb'" size="small" :with-header="false" width="20%">
      <Find
              :OriginalFilter="{ static: true }"
              style="margin-left: 15px"
              :searchImg="false"
              :formList="formList20"
              @Launchform="Launchform25"
            />
      <Table
        @currentRow1="currentRow27"
        :tableHeader="tableHeaderStyleNo12"
        :tableData="RdTypeBodyFilePositionListTableDate"
        :TableHeight="100"
        :outTableHeight="80"
      />
      <PageModule
        style="width: 100%"
        :PageData="{ buttonS: true, total: totalKlt1, pageSizeShow: true }"
        @pageChange="handleSizeChange21"
        @pageSizeChange="handleCurrentChange21"
         :layout="'prev, pager'"
      />
</el-dialog>
  </div>
</template>
<script lang="ts">
import { defineComponent, onMounted, ref, onUnmounted, watch, reactive, toRefs } from 'vue'
import { GetVendorList, type GetVendorListListParms } from '@/api/WarehouseDepartment/FactoryStorage/InputInsoleReceivingIssuingMaterials'
import { VendorData } from '@/api/WarehouseDepartment/FactoryStorage/TemporaryReceiptStorage'
import {
  UnitDefinition,
  type FitProcessingMethodInterface,
  FitProcessingMethod
} from '@/api/ControlDepartment/MaterialManagement/MaterialAttributeDefinition'
import {cloneDeep,debounce } from 'lodash'
import fileRequest from '@/utils/fileRequest'
import { ColorCodeUpdate } from '@/api/ControlDepartment/MaterialManagement/BulkQuantityFile'
import service from "@/utils/request"
import JMessage from '@/utils/JMessage'
export default defineComponent({
  name: 'ResearchAndDevelopmentVolumeDocumentation'
})
</script>
<script lang="ts" setup>
import {
  BasicNumber,
  deleteCofficial,
  partNameQuery,
  copyData,
  selectMtlName,
  BondingMaterialTreatment,
  styleColorQuery,
  InsertTheBondingMaterial,
  ProductionOfOfficialMaterials,
  SelectTheCurrentRowToInsert,
  UpdateFullCodeUsage,
  DeleteTheCheckmarkedRecordType,
  CopyData,
  PrecautionsFileList,
  PrecautionsFile,
  UsageChangeQuery,
  UsageDetailQuery,
  FullCodeUsageCheck,
  saveDateList,
  FullCodeUsageData,
  LaminatedSubmaterial,
  TypeColorDataQuery,
  TypeQuery,
  ColorCodePicture,
  PositionDetailQuery,
  RdTypeBodyFileOrderList,
  RdTypeBodyFileAdd,
  RdTypeBodyFileDelete,
  RdTypeBodyFileCheck,
  RdTypeBodyFileCancelCheck,
  RdTypeBodyFileEdit,
  RdTypeBodyFileNoteDelete,
  RdTypeBodyFilePositionList,
  RdTypeBodyFileSave,
  idQuery
} from '@/api/ControlDepartment/MaterialManagement/ResearchAndDevelopmentVolumeDocumentation1'
import type {
  InsertTheBondingMaterialParms,
  ProductionOfOfficialMaterialsParms,
  SelectTheCurrentRowToInsertParms,
  UpdateFullCodeUsagePamrs,
  DeleteTheCheckmarkedRecordTypePamrs,
  CopyDataParms,
  UsageChangeQueryInterface,
  UsageChangeQueryparms,
  UsageDetailQueryPamrsList,
  UsageDetailQueryParmsList,
  saveDateListParms,
  FullCodeUsageDataParms,
  LaminatedSubmaterialInterface,
  PositionDetailQueryPamrs,
  TypeColorDataQueryInterface,
  TypeColorDataQueryParms,
  TypeQueryParms,
  ColorCodePictureTableDate,
  ColorCodePictureParms,
  
} from '@/api/ControlDepartment/MaterialManagement/ResearchAndDevelopmentVolumeDocumentation'
import {
  InsertTheBondingMaterialList1,
  InsertTheBondingMaterialList,
  ListOfFitAddList,
  colourCcheme,
  chooseAColor,
  FormalMaterialsAndDevelopmentMaterials,
  ListOfFitMaterials,
  FitMaterialProfileDeleted,
  ObtainVendor,
  Fluctuation,
  TheCompositeMaterialIsFormed,
  LaminatedMaterialFile,
  FormalMaterialsAndDevelopmentMaterials1
} from '@/api/ControlDepartment/MaterialManagement/LaminatedMaterialFile'
import type {
  ListOfFitAddListInterface,
  chooseAColorInterface,
  chooseAColorParms,
  FormalMaterialsAndDevelopmentMaterialsParms,
  FormalMaterialsAndDevelopmentMaterialsInterface,
  ListOfFitMaterialsInterface
} from '@/api/ControlDepartment/MaterialManagement/LaminatedMaterialFile'
import LoginWork from '@/utils/LoginWork'
import { ElMessage } from 'element-plus'
import { ElMessageBox } from 'element-plus'
import { classifyQuery } from '@/api/WarehouseDepartment/FactoryStorage/FitOutsourcingProcessing'
import { useRouter } from 'vue-router'
// 根据id进行查询


// 保存
const RdTypeBodyFileSaveParms = ref<any>([])
const RdTypeBodyFileSaveMethods = async() => {
  RdTypeBodyFileSaveParms.value = TypeColorDataQueryMethodsInterfaceTableDateList.value.filter(item => item.partName)
  RdTypeBodyFileSaveParms.value = RdTypeBodyFileSaveParms.value.map((item:any) => {
    
      item.styleNo = TypeColorDataQueryMethodsPamrs.value.styleNo
      item.orderId = TypeColorDataQueryMethodsPamrs.value.orderId
      item.styleColor = TypeColorDataQueryMethodsPamrs.value.styleColor
      item.isTest = item.isTest ? '1' : '0'
    return item
  })
  const result = await RdTypeBodyFileSave(RdTypeBodyFileSaveParms.value)
  if(result.code === 200){
    TypeColorDataQueryMethods()
    ElMessage.success(result.msg)
  }else{
    ElMessage.error(result.msg)
  }
}

// 部位列表查询
const RowPartNameList= ref()
const currentRow20 = (row: any, cloum: string) => {
  if (cloum === 'seqNo') {
    AllSizeNo1.value = true
  }
  if(cloum === 'partName'){
    AllSizeNo130.value = true
    RowPartNameList.value = row
  }

  formList15.value[0].inputValue = row.seqNo
  AllSizeNo13.value = row.seqNo
  formList15.value[1].inputValue = ''
  
}

const formList20 = ref([
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '请输入部门'
  },
  // {
  //   type: 'button',
  //   checkboxLabel: '保存',bgColor:'#1890FF',
  // },
  // {
  //   type: 'button',
  //   checkboxLabel: '检核',
  //   bgColor:'#1890FF',
  // },

  // {
  //   type: 'button',
  //   checkboxLabel: '颜色代码更新',
  // },
])

const Launchform25 = (row:any) => {
  RdTypeBodyFilePositionListParms.value.partName = row[0].inputValue
  RdTypeBodyFilePositionListMethods()
}

const currentRow27 = (row:any) => {
  AllSizeNo130.value = false
  RowPartNameList.value.partName = row.partName
}

const RdTypeBodyFilePositionListParms = ref({
  partName:'',
  pageSize:40,
  pageNum:1
})
const totalKlt1 = ref(0)

const handleSizeChange21 = (val: number) => {
  RdTypeBodyFilePositionListParms.value.pageNum = val
  RdTypeBodyFilePositionListMethods()
}

const handleCurrentChange21 = (val: number) => {
  RdTypeBodyFilePositionListParms.value.pageSize = val
  RdTypeBodyFilePositionListMethods()
}

const AllSizeNo130 = ref(false)

const RdTypeBodyFilePositionListTableDate = ref([])

const RdTypeBodyFilePositionListMethods = async () => {
  const result = await RdTypeBodyFilePositionList(RdTypeBodyFilePositionListParms.value)
  if(result.code === 200){
    RdTypeBodyFilePositionListTableDate.value = result.rows
    totalKlt1.value = result.total
  }else{
    ElMessage.error(result.msg)
  }

}


// 明细查询
const AllSizeNo128 = ref(false)

watch(AllSizeNo128,() => {
  if(!AllSizeNo128.value){
  }
})

const currentRow13 = (row:any) => {
    AllSizeNo128.value = true
    TypeColorDataQueryMethodsPamrs.value.orderId = row.orderId
    TypeColorDataQueryMethodsPamrs.value.styleColor = row.styleColor
    TypeColorDataQueryMethodsPamrs.value.styleNo = row.styleNo

    SelectTheCurrentRowToInsertMethodsParms.value.orderId = row.orderId
    SelectTheCurrentRowToInsertMethodsParms.value.styleColor = row.styleColor
    SelectTheCurrentRowToInsertMethodsParms.value.styleNo = row.styleNo

    InsertTheBondingMaterialMethodsListAParms.value.styleNo = row.styleNo
    InsertTheBondingMaterialMethodsListAParms.value.styleColor = row.styleColor
    InsertTheBondingMaterialMethodsListAParms.value.orderId = row.orderId

    InsertTheBondingMaterialList1Parms.value.styleNo = row.styleNo
    InsertTheBondingMaterialList1Parms.value.styleColor = row.styleColor
    InsertTheBondingMaterialList1Parms.value.orderId = row.orderId

    ProductionOfOfficialMaterialsMethodsParms.value.styleNo = row.styleNo
    ProductionOfOfficialMaterialsMethodsParms.value.styleColor = row.styleColor
    ProductionOfOfficialMaterialsMethodsParms.value.orderId = row.orderId
  
    TypeColorDataQueryMethods()
  
}





// 注意事项建档删除
const RdTypeBodyFileNoteDeleteMethods = async(row:any) => {
  const result = await RdTypeBodyFileNoteDelete(row.id)
  if(result.code === 200){
    JMessage.success(result.msg)
    PrecautionsFileMethods() 
  }else{
    JMessage.error(result.msg)
  }
}

const handleCloseMateriaLKlc10 = (row:any) => {
  ElMessageBox.confirm('确认要删除吗?')
    .then(async () => {
      RdTypeBodyFileNoteDeleteMethods(row)
    })
    .catch(() => {})
}

const download5 = (row: any, item: any) => {
  if(item.label === '删除'){
    handleCloseMateriaLKlc10(row)
  }
}

// 注意事项建档保存
const inputChange = async (row: any) => {
  delete row.change
  const result = await service.put<any, any>('/mes/kfBom/updateMemo',row)
  if (result.code === 200) {
    PrecautionsFileMethods()
    JMessage.success(result.msg)
  } else {
    JMessage.error(result.msg)
  }
}

// BOM修改
const RdTypeBodyFileEditParms = ref()
const RdTypeBodyFileEditMethods = async() => {
  const result = await RdTypeBodyFileEdit(RdTypeBodyFileEditParms.value)
  if(result.code === 200){
    ElMessage.success(result.msg)
    AllSizeNo127.value = false
    TypeQueryMethods() 
  }else{
    ElMessage.error(result.msg)
  }
}

const handleAvatarSuccess1 = async (response: any,) => {
if(response.code === 200){
  const url =  await service.get<any, any>(`/file/oss/view/${response.data.bucketName}/${response.data.fileName}`);
    if(RdTypeBodyFileEditParms.value){
      RdTypeBodyFileEditParms.value.photoId = response.data.fileId
  }
 
  imageUrl.value = 'data:image/png;base64,'+url.data
  ElMessage.success('上传图片成功')
}else{
  ElMessage.warning('图片上传失败!请重试')
}



}

// 修改
const imageUrl = ref('')

const AllSizeNo127 = ref(false)

// 取消检核
const RdTypeBodyFileCancelCheckParms = ref('')
const RdTypeBodyFileCancelCheckMethods = async() => {
  if(RdTypeBodyFileCancelCheckParms.value === ''){
    ElMessage.warning('请点击需要取消检核的数据')
    return
  }
   const result = await RdTypeBodyFileCancelCheck(RdTypeBodyFileCancelCheckParms.value)
   if(result.code === 200){
    RdTypeBodyFileCancelCheckParms.value = ''
    ElMessage.success(result.msg) 
    TypeQueryMethods()
  }else{
    ElMessage.error(result.msg)
  }
}

const currentRow1 = (row: any) => {

  RdTypeBodyFileCheckParms.value = row.id
  RdTypeBodyFileCancelCheckParms.value = row.id
  UsageChangeQueryMethodsParms.value.orderId = row.orderId
  UsageChangeQueryMethodsParms.value.styleColor = row.styleColor
  UsageChangeQueryMethodsParms.value.styleNo = row.styleNo
}

// 检核
const selection1 = (row:any) => {
  RdTypeBodyFileCheckParms.value = row.map((item:any) => {
    return item.id
  })
  RdTypeBodyFileCancelCheckParms.value = row.map((item:any) => {
    return item.id 
  })
}

const RdTypeBodyFileCheckParms = ref('')
const RdTypeBodyFileCheckMethods = async() => {
  if(RdTypeBodyFileCheckParms.value === ''){
    ElMessage.warning('请点击需要检核的数据')
    return
  }
  const result = await RdTypeBodyFileCheck(RdTypeBodyFileCheckParms.value)
  if(result.code === 200){
    RdTypeBodyFileCheckParms.value = ''
    ElMessage.success(result.msg) 
    TypeQueryMethods()
  }else{
    ElMessage.error(result.msg)
  }
}

// BOM整单删除
const handleCloseMateriaLKlc5 = (row:any) => {
  ElMessageBox.confirm('确认要删除吗?')
    .then(async () => {
      RdTypeBodyFileDeleteMethods(row)
    })
    .catch(() => {})
}

const RdTypeBodyFileCodeTableDat1 = ref<any>([])
const RdTypeBodyFileOrderListParms1 = ref({
  styleNo:'',
  styleColor:''
})
const RdTypeBodyFileOrderListMethods1 = debounce(async() => {
  try {
    const result = await RdTypeBodyFileOrderList(RdTypeBodyFileOrderListParms1.value)
    RdTypeBodyFileCodeTableDat1.value = result.data.list
  } catch (error) {
    ElMessage.error('订单号查询失败')
  }
},1000)
const download = (row: any, item: any) => {
  if(item.label === '删除'){
    handleCloseMateriaLKlc5(row)
  }
  if(item.label === '复制资料'){
    dialogVisible1.value = true
    CopyDataMethodsPamrs.value.styleNo = row.styleNo
    CopyDataMethodsPamrs.value.styleColor = row.styleColor
    CopyDataMethodsPamrs.value.orderId = row.orderId
    CopyDataMethodsPamrs.value.id = row.id
  }
  if(item.label === '修改'){
    imageUrl.value  = row.photoPath
    RdTypeBodyFileOrderListParms1.value.styleColor = row.styleColor
    RdTypeBodyFileOrderListParms1.value.styleNo = row.styleNo
    RdTypeBodyFileOrderListMethods1()
    RdTypeBodyFileEditParms.value = cloneDeep(row) 
    AllSizeNo127.value = true 
  }
}
const RdTypeBodyFileDeleteMethods = async(row:any) => {
  try {
    const result = await RdTypeBodyFileDelete(row.id)
    if(result.code === 200 ){
      TypeQueryMethods()
      ElMessage.success(result.msg)
    } else{
      ElMessage.error(result.msg)
    }

  }catch{
    ElMessage.error('删除失败')
  }
}
// BOM新增
const RdTypeBodyFileAddMethodsParmsParms = ref({
  baseSize: "",
  colorCode: "",
  companyId: "",
  deptId: 0,
  id: "",
  orderId: "",
  photoId: "",
  remark: "",
  styleColor: "",
  styleNo: ""
})
const imgList3 = ref<any>([ ])
const RdTypeBodyFileAddMethods = async() => {
  RdTypeBodyFileAddMethodsParmsParms.value.styleNo = RdTypeBodyFileOrderListParms.value.styleNo
  // RdTypeBodyFileAddMethodsParmsParms.value.styleColor = RdTypeBodyFileOrderListParms.value.styleColor
  if(RdTypeBodyFileAddMethodsParmsParms.value.orderId === "" || RdTypeBodyFileAddMethodsParmsParms.value.styleNo === "" || RdTypeBodyFileAddMethodsParmsParms.value.styleColor === ""){
    ElMessage.warning('型体号、颜色、订单号不能为空')
    return
  }
  
  try {
    const result = await RdTypeBodyFileAdd(RdTypeBodyFileAddMethodsParmsParms.value)
    if(result.code === 200){
      
      RdTypeBodyFileAddMethodsParmsParms.value.orderId = ""
      RdTypeBodyFileAddMethodsParmsParms.value.styleNo = ""
      RdTypeBodyFileAddMethodsParmsParms.value.styleColor = ""
      RdTypeBodyFileAddMethodsParmsParms.value.colorCode = ""
      RdTypeBodyFileAddMethodsParmsParms.value.photoId = ""
      RdTypeBodyFileAddMethodsParmsParms.value.baseSize = ""
      RdTypeBodyFileAddMethodsParmsParms.value.remark = ""
      ElMessage.success(result.msg)
      AllSizeNo126.value = false
      TypeQueryMethods()
    }else{
      ElMessage.error(result.msg)
    }
  }catch{
    ElMessage.error('w')
  }
}

// 订单号查询
const RdTypeBodyFileCodeTableDat = ref<any>([])
const RdTypeBodyFileOrderListParms = ref({
  styleNo:'',
  styleColor:''
})
const RdTypeBodyFileOrderListMethods = debounce(async() => {
  try {
    const result = await RdTypeBodyFileOrderList(RdTypeBodyFileOrderListParms.value)
    RdTypeBodyFileCodeTableDat.value = result.data.list
    const files = result.data.files;  

      // 获取 files 对象的第一个键  
      const firstKey = Object.keys(files)[0];  

      RdTypeBodyFileAddMethodsParmsParms.value.photoId = files[firstKey].fileId;
  } catch (error) {
    ElMessage.error('订单号查询失败')
  }
},1)




// 新增数据
const AllSizeNo126 = ref(false)

const data = reactive({
  form: {},
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    postCode: undefined,
    postName: undefined,
    status: undefined
  },
  rules: {
    postName: [{ required: true, msg: '材料属性不能为空', trigger: 'blur' }],
    postSort: [{ required: true, msg: '名称组成顺序不可为空', trigger: 'blur' }]
  }
})

const { queryParams, form, rules } = toRefs(data)




// 修改基本号

const Launchform30 = (row: any) => {
  ubdateSizeNoMethodsParms.value.baseSize = row[11].inputValue
}
const ubdateSizeNoMethodsParms = ref<any>({
  baseSize: '',
  styleColor: '',
  styleColorMaterialRequests: [],
  styleColorRemark: '',
  styleNo: ''
})

const ubdateSizeNoMethods = async () => {
  ubdateSizeNoMethodsParms.value.orderId = UsageChangeQueryMethodsParms.value.orderId
  const result = await BasicNumber(ubdateSizeNoMethodsParms.value)
  if (result.code === 200) {
    ColorCodePictureMethods()
    JMessage.success(result.msg)
  } else {
    JMessage.error(result.msg)
  }
}

const image = ref('')

const toUp = async (event: any, rowIndex: number, row: any, row1: any, prop: any) => {
  // 直接使用 rowIndex 获取元素
  ColorMtl.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex + 1].mtlColor
  confirmChange20TableDate.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex + 1]
  currentTableRow.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex + 1]
  mtlNameSpace.value.mtlName = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex + 1].mtlName
  mtlNameSpace.value.mtlSpec = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex + 1].mtlSpec
  mtlNameSpace.value.mtlUnit = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex + 1].mtlUnit
  tableDateList.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex + 1]
  mtlNoAny.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex + 1].mtlNo
  const { mtlNo, segment, partName, seqNo, mtlUnit, mtlColor, mtlName, mtlSpec, vendor } = TypeColorDataQueryMethodsInterfaceTableDateList.value[
    rowIndex + 1
  ] as any
  partNameList.value.partNmae = partName
  partNameList.value.segment = segment
  mtlNoYes.value = mtlNo
  mtlNo1List.value = mtlNo
  // LaminatedSubmaterialMethods()
  FullCodeUsageDataMethodsParms.value.partName = partName
  FullCodeUsageDataMethodsParms.value.segment = segment
  // FullCodeUsageDataMethods()
  UpdateFullCodeUsageMethodsParmsList.value.push({ partName: partName, segment: segment, change: 'Y' })
  SelectTheCurrentRowToInsertMethodsParms.value.seqNo = seqNo
  SelectTheCurrentRowToInsertMethodsParms.value.segment = segment
  SelectTheCurrentRowToInsertMethodsParms.value.partName = partName
  //
  SelectTheCurrentRowToInsertMethodsParms.value.mtlNo = mtlNo

  // const result = await selectMtlName(mtlNameSpace.value)
  // if (result !== null) {
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlUnit = result.mtlUnit
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlName = result.mtlName
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlSpec = result.mtlSpec
  //   ProductionOfOfficialMaterialsMethodsParms.value.vendor = result.vendor
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlNo = result.mtlNo
  // } else {
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlUnit = ''
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlName = ''
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlSpec = ''
  //   ProductionOfOfficialMaterialsMethodsParms.value.vendor = ''
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlNo = ''
  // }

  ProductionOfOfficialMaterialsMethodsParms.value.partName = partName
  ProductionOfOfficialMaterialsMethodsParms.value.seqNo = seqNo
  ProductionOfOfficialMaterialsMethodsParms.value.segment = segment

  InsertTheBondingMaterialMethodsListAParms.value.mtlColor = mtlColor
  InsertTheBondingMaterialMethodsListAParms.value.mtlName = mtlName
  InsertTheBondingMaterialMethodsListAParms.value.mtlNo = mtlNo
  InsertTheBondingMaterialMethodsListAParms.value.mtlSpec = mtlSpec
  InsertTheBondingMaterialMethodsListAParms.value.mtlUnit = mtlUnit
  InsertTheBondingMaterialMethodsListAParms.value.partName = partName
  InsertTheBondingMaterialMethodsListAParms.value.segment = segment
  InsertTheBondingMaterialMethodsListAParms.value.seqNo = seqNo
  InsertTheBondingMaterialMethodsListAParms.value.vendor = vendor

  BondingMaterialTreatmentParms.value.mtlColor = mtlColor
  BondingMaterialTreatmentParms.value.mtlName = mtlName
  BondingMaterialTreatmentParms.value.mtlNo = mtlNo
  BondingMaterialTreatmentParms.value.mtlSpec = mtlSpec
  BondingMaterialTreatmentParms.value.mtlUnit = mtlUnit
  BondingMaterialTreatmentParms.value.partName = partName
  BondingMaterialTreatmentParms.value.segment = segment
  BondingMaterialTreatmentParms.value.seqNo = seqNo

  //
  BondingMaterialTreatmentParms.value.vendor = vendor

  if (prop === 'usage') {
    const element = row.data[rowIndex + 1]

    if (element) {
      // 计算下一个行索引
      const nextRowIndex = rowIndex + 1

      // 确保下一个索引在范围内
      if (nextRowIndex < TypeColorDataQueryMethodsInterfaceTableDateList.value.length) {
        // 通过 v-for 中的 :ref 属性获取下一个输入框
        const nextInput = document.getElementById(`input-${rowIndex + 1}`)
        if (nextInput) {
          ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
          ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
        }
      } else {
      }
    } else {
    }
  } else if (prop === 'partName') {
    const element = row.data[rowIndex + 1]
    if (element) {
      // 计算下一个行索引
      const nextRowIndex = rowIndex + 1

      // 确保下一个索引在范围内
      if (nextRowIndex < TypeColorDataQueryMethodsInterfaceTableDateList.value.length) {
        // 通过 v-for 中的 :ref 属性获取下一个输入框
        const nextInput = document.getElementById(`input-${prop}${rowIndex + 1}`)
        if (nextInput) {
          ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
          ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
        }
      } else {
      }
    } else {
    }
  } else if (prop === 'mtlNo') {
    const element = row.data[rowIndex + 1]
    if (element) {
      // 计算下一个行索引
      const nextRowIndex = rowIndex + 1

      // 确保下一个索引在范围内
      if (nextRowIndex < TypeColorDataQueryMethodsInterfaceTableDateList.value.length) {
        // 通过 v-for 中的 :ref 属性获取下一个输入框
        const nextInput = document.getElementById(`input-${prop}${rowIndex + 1}`)
        if (nextInput) {
          ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
          ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
        }
      } else {
      }
    } else {
    }
  } else if (prop === 'size1') {
    const element = row.data[rowIndex + 1]
    if (element) {
      // 计算下一个行索引
      const nextRowIndex = rowIndex + 1

      // 确保下一个索引在范围内
      if (nextRowIndex < TypeColorDataQueryMethodsInterfaceTableDateList.value.length) {
        // 通过 v-for 中的 :ref 属性获取下一个输入框
        const nextInput = document.getElementById(`input-${prop}${rowIndex + 1}`)
        if (nextInput) {
          ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
          ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
        }
      } else {
      }
    } else {
    }
  } else if (prop === 'size2') {
    const element = row.data[rowIndex + 1]
    if (element) {
      // 计算下一个行索引
      const nextRowIndex = rowIndex + 1

      // 确保下一个索引在范围内
      if (nextRowIndex < TypeColorDataQueryMethodsInterfaceTableDateList.value.length) {
        // 通过 v-for 中的 :ref 属性获取下一个输入框
        const nextInput = document.getElementById(`input-${prop}${rowIndex + 1}`)
        if (nextInput) {
          ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
          ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
        }
      } else {
      }
    } else {
    }
  }
}

const toBottom = async (event: any, rowIndex: any, row: any, row1: any, prop: any) => {
  // 直接使用 rowIndex 获取元素
  ColorMtl.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex - 1].mtlColor
  confirmChange20TableDate.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex - 1]
  currentTableRow.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex - 1]
  mtlNameSpace.value.mtlName = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex - 1].mtlName
  mtlNameSpace.value.mtlSpec = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex - 1].mtlSpec
  mtlNameSpace.value.mtlUnit = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex - 1].mtlUnit
  tableDateList.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex - 1]
  mtlNoAny.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex - 1].mtlNo
  const { mtlNo, segment, partName, seqNo, mtlUnit, mtlColor, mtlName, mtlSpec, vendor } = TypeColorDataQueryMethodsInterfaceTableDateList.value[
    rowIndex - 1
  ] as any
  partNameList.value.partNmae = partName
  partNameList.value.segment = segment
  mtlNoYes.value = mtlNo
  mtlNo1List.value = mtlNo
  // LaminatedSubmaterialMethods()
  FullCodeUsageDataMethodsParms.value.partName = partName
  FullCodeUsageDataMethodsParms.value.segment = segment
  // FullCodeUsageDataMethods()
  UpdateFullCodeUsageMethodsParmsList.value.push({ partName: partName, segment: segment, change: 'Y' })
  SelectTheCurrentRowToInsertMethodsParms.value.seqNo = seqNo
  SelectTheCurrentRowToInsertMethodsParms.value.segment = segment
  SelectTheCurrentRowToInsertMethodsParms.value.partName = partName
  //
  SelectTheCurrentRowToInsertMethodsParms.value.mtlNo = mtlNo

  // const result = await selectMtlName(mtlNameSpace.value)
  // if (result !== null) {
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlUnit = result.mtlUnit
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlName = result.mtlName
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlSpec = result.mtlSpec
  //   ProductionOfOfficialMaterialsMethodsParms.value.vendor = result.vendor
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlNo = result.mtlNo
  // } else {
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlUnit = ''
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlName = ''
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlSpec = ''
  //   ProductionOfOfficialMaterialsMethodsParms.value.vendor = ''
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlNo = ''
  // }

  ProductionOfOfficialMaterialsMethodsParms.value.partName = partName
  ProductionOfOfficialMaterialsMethodsParms.value.seqNo = seqNo
  ProductionOfOfficialMaterialsMethodsParms.value.segment = segment

  InsertTheBondingMaterialMethodsListAParms.value.mtlColor = mtlColor
  InsertTheBondingMaterialMethodsListAParms.value.mtlName = mtlName
  InsertTheBondingMaterialMethodsListAParms.value.mtlNo = mtlNo
  InsertTheBondingMaterialMethodsListAParms.value.mtlSpec = mtlSpec
  InsertTheBondingMaterialMethodsListAParms.value.mtlUnit = mtlUnit
  InsertTheBondingMaterialMethodsListAParms.value.partName = partName
  InsertTheBondingMaterialMethodsListAParms.value.segment = segment
  InsertTheBondingMaterialMethodsListAParms.value.seqNo = seqNo
  InsertTheBondingMaterialMethodsListAParms.value.vendor = vendor

  BondingMaterialTreatmentParms.value.mtlColor = mtlColor
  BondingMaterialTreatmentParms.value.mtlName = mtlName
  BondingMaterialTreatmentParms.value.mtlNo = mtlNo
  BondingMaterialTreatmentParms.value.mtlSpec = mtlSpec
  BondingMaterialTreatmentParms.value.mtlUnit = mtlUnit
  BondingMaterialTreatmentParms.value.partName = partName
  BondingMaterialTreatmentParms.value.segment = segment
  BondingMaterialTreatmentParms.value.seqNo = seqNo

  //
  BondingMaterialTreatmentParms.value.vendor = vendor
  if (prop === 'usage') {
    // 计算下一个行索引
    const nextRowIndex = rowIndex + 1

    // 确保下一个索引在范围内
    // 通过 v-for 中的 :ref 属性获取下一个输入框
    const nextInput = document.getElementById(`input-${rowIndex - 1}`)
    if (nextInput) {
      ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
      ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
    }
  } else if (prop === 'partName') {
    const element = row.data[rowIndex + 1]
    if (element) {
      // 计算下一个行索引
      const nextRowIndex = rowIndex + 1

      // 确保下一个索引在范围内
      if (nextRowIndex < TypeColorDataQueryMethodsInterfaceTableDateList.value.length) {
        // 通过 v-for 中的 :ref 属性获取下一个输入框
        const nextInput = document.getElementById(`input-${prop}${rowIndex - 1}`)
        if (nextInput) {
          ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
          ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
        }
      } else {
      }
    } else {
    }
  } else if (prop === 'mtlNo') {
    const element = row.data[rowIndex + 1]
    if (element) {
      // 计算下一个行索引
      const nextRowIndex = rowIndex + 1

      // 确保下一个索引在范围内
      if (nextRowIndex < TypeColorDataQueryMethodsInterfaceTableDateList.value.length) {
        // 通过 v-for 中的 :ref 属性获取下一个输入框
        const nextInput = document.getElementById(`input-${prop}${rowIndex - 1}`)
        if (nextInput) {
          ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
          ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
        }
      } else {
      }
    } else {
    }
  } else if (prop === 'size1') {
    const element = row.data[rowIndex + 1]
    if (element) {
      // 计算下一个行索引
      const nextRowIndex = rowIndex + 1

      // 确保下一个索引在范围内
      if (nextRowIndex < TypeColorDataQueryMethodsInterfaceTableDateList.value.length) {
        // 通过 v-for 中的 :ref 属性获取下一个输入框
        const nextInput = document.getElementById(`input-${prop}${rowIndex - 1}`)
        if (nextInput) {
          ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
          ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
        }
      } else {
      }
    } else {
    }
  } else if (prop === 'size2') {
    const element = row.data[rowIndex + 1]
    if (element) {
      // 计算下一个行索引
      const nextRowIndex = rowIndex + 1

      // 确保下一个索引在范围内
      if (nextRowIndex < TypeColorDataQueryMethodsInterfaceTableDateList.value.length) {
        // 通过 v-for 中的 :ref 属性获取下一个输入框
        const nextInput = document.getElementById(`input-${prop}${rowIndex - 1}`)
        if (nextInput) {
          ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
          ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
        }
      } else {
      }
    } else {
    }
  }
}

const inputChange25 = (row: any) => {}

const LaminatedMaterialFileMethods = async () => {
  const result = await LaminatedMaterialFile(
    MethodOfBondingMaterialTableDateList.value?.map((item: any) => {
      item.prdType = item.prdType.selectValue
      item.vendor = item.vendor.selectValue.split(' ')[1]
      item.purFlag = item.purFlag === true ? 'Y' : ''
      return item
    })
  )
  if (result.code === 200) {
    MethodOfBondingMaterial()
    JMessage.success(result.msg)
  } else {
    JMessage.error(result.msg)
  }
}

// 删除正式材料
const deleteCofficialMethodsParms = ref('')

const handleCloseMateriaLKlc12 = (_done?: () => void) => {
  ElMessageBox.confirm('确定要删除该数据吗')
    .then(async () => {
      deleteCofficialMethods()
    })
    .catch(() => {})
}

const deleteCofficialMethods = async () => {
  try {
    const result = await deleteCofficial(deleteCofficialMethodsParms.value)
    if (result.code === 200) {
      FormalMaterialsAndMethodsForDevelopingMaterials()
      JMessage.success(result.msg)
    } else {
      JMessage.error(result.msg)
    }
  } catch (error) {
    JMessage.warning('删除失败请重试')
  }
}

const ColorMtl = ref('')

const AllSizeNo125 = ref(false)

const inputDBclick1 = (row?: any) => {
  if (CopyDataMethodsPamrs.value.newStyleNo === '') {
    JMessage.warning('查询颜色名称型体不可为空')
  } else {
    CopyDataMethodsPamrsStyle.value.styleNo = CopyDataMethodsPamrs.value.newStyleNo
    AllSizeNo125.value = true
    styleColorQueryMethods1()
  }
}

const ColorCodePictureMethodsParms1 = ref<ColorCodePictureParms>({
  colorCode: '',
  pageNum: 1,
  pageSize: 40,
  styleColor: '',
  styleNo: ''
})

const ColorCodePictureMethods1 = async () => {
  const result = await ColorCodePicture(ColorCodePictureMethodsParms1.value)
  FullCodeUsageDataMethodsTableDateLsi1t1.value = result.list
}

const FullCodeUsageDataMethodsTableDateLsi1t1 = ref([])

const CopyDataMethodsPamrsStyle = ref({
  styleNo: ''
})

const styleColorQueryMethods1 = async () => {
  try {
    const result = await styleColorQuery(CopyDataMethodsPamrsStyle.value)
    FullCodeUsageDataMethodsTableDateLsi1t1.value = result.list
  } catch (error) {
    JMessage.error('颜色名称代号查询出错')
  }
}

const currentRow26 = (row: any) => {
  AllSizeNo125.value = false
  CopyDataMethodsPamrs.value.newStyleColor = row.styleColor
  CopyDataMethodsPamrs.value.newOrderId = row.orderId
}

const inputBlur = async (e: any) => {
  if (isListTav.value) {
    const colorParam = encodeURIComponent(ProductionOfOfficialMaterialsMethodsParms.value.mtlColor)
    const result1 = await LoginWork.get<any, any>(`/ColorAttribute/getYfColorDetail?color=${colorParam}`)
    if (result1.data === null) {
      ProductionOfOfficialMaterialsMethodsParms.value.mtlColor = ''
      JMessage.error(`该颜色不存在不可修改`)
    } else {
      ProductionOfOfficialMaterialsMethodsParms.value.colorCode = result1.data.colorCode
    }
  }
}

const isListTav = ref(true)

const doubeList = () => {
  AllSizeNo123.value = true
}

const currentRow30 = (row: any) => {
  ColorCodePictureMethodsParms1.value.styleNo = row.style
  CopyDataMethodsPamrs.value.newStyle = row.styleNo
    CopyDataMethodsPamrs.value.newColor = row.styleColor
    CopyDataMethodsPamrs.value.newOrderId = row.orderId
  AllSizeNo123.value = false
}

const AllSizeNo123 = ref(false)

// 贴合材料处理还原
const BondingMaterialTreatmentParms = ref({
  colorCode: '',
  mtlColor: '',
  mtlName: '',
  mtlNo: '',
  mtlSpec: '',
  mtlUnit: '',
  partName: '',
  segment: '',
  seqNo: '',
  styleColor: '',
  styleNo: '',
  vendor: ''
})

const BondingMaterialTreatmentMethods = async () => {
  try {
    const result = await BondingMaterialTreatment(BondingMaterialTreatmentParms.value)
  } catch (error) {
    JMessage.error('还原材料异常')
  }
}

const mtlNoAny = ref('')

const inputChange20 = (row: any, blum: any) => {
  if (blum === '部位   ') {
    PositionDetailQueryMethodsParms.value.partName = row.partName
    partNameQueryMehtods(row.partName, row)
    return
  }
  if (blum === '物料编码' && row.mtlNo !== '') {
    copyDataParms.value.mtlNo = row.mtlNo
    copyDataParms.value.partName = row.partName
    copyDataParms.value.seqNo = row.seqNo
    copyDataParms.value.segment = row.segment
    vendorList.value = row.vendor
    if (copyDataParms.value.partName === '') {
      JMessage.warning('复制时部位不可为空')
      return
    }
    copyDataMethods(row)
    return
  }

  if (row.mtlNo === '') {
    
    for (const key in row) {
      if (
        key !== 'seqNo' &&
        key !== 'partName' &&
        key !== 'segment' &&
        key !== 'usage' &&
        key !== 'usageType' &&
        key !== 'sizeType' &&
        key !== 'drawDept' &&
        key !== 'mtlProperty'&&
        key !== 'id'&&
        key !== 'companyId'
      ) {
        // 排除 seqNo 和 partName
        row[key] = '' // 将其他属性设置为空字符串
      }
    }
    row.change = 'Y'
    row.disableConfirm = true
    return
  } 
  
}

const copyDataMethods = async (row: any) => {
  copyDataParms.value.orderId = TypeColorDataQueryMethodsPamrs.value.orderId
  copyDataParms.value.styleNo = TypeColorDataQueryMethodsPamrs.value.styleNo

  copyDataParms.value.styleColor = TypeColorDataQueryMethodsPamrs.value.styleColor
  row.mtlNo = row.mtlNo.trim()
  const result = await copyData(copyDataParms.value)
  if (result.code === 200) {
    // row.mtlNo = result.data.mtlNo
    // row.mtlName = result.data.mtlName
    // row.mtlColor = result.data.mtlColor
    // row.mtlSpec = result.data.mtlSpec
    // row.size1 = result.data.size1
    // row.size2 = result.data.size2
    // row.mtlUnit = result.data.mtlUnit
    // row.vendor = result.data.vendor

    // row.drawDept.selectValue = result.data.drawDept
    // row.mtlProperty.selectValue = result.data.mtlProperty
    // row.usageType.selectValue = result.data.usageType
    TypeColorDataQueryMethods()
    
  } else {
    JMessage.error(result.msg)
  }
}

const partNameQueryMehtods = async (partName: string, row: any) => {
  const result = await partNameQuery(partName)
  if (result.code === 500) {
    JMessage.error(result.msg)
    row.partName = ''
    return
  }
}

const copyDataParms = ref({
  colorCode: '',
  mtlColor: '',
  mtlName: '',
  mtlNo: '',
  mtlSpec: '',
  mtlUnit: '',
  partName: '',
  segment: '',
  seqNo: '',
  styleColor: '',
  styleNo: '',
  vendor: '',
  orderId:'',
  id:''
})

const confirmChange20TableDate = ref<any>()

const confirmChange20 = (row: any) => {}

// 双击事件查询颜色代号
const currentRow25 = (row: any) => {
  formList1.value[1].inputValue = row.styleColor
  formList1.value[2].inputValue = row.orderId
  ColorCodePictureMethodsParms.value.styleColor = row.styleColor
  ColorCodePictureMethodsParms.value.colorCode = row.colorCode
  AllSizeNo12.value = false
}

const inputDBclick = (row: any) => {
  if (formList1.value[0].inputValue === '') {
    JMessage.warning('查询颜色名称型体不可为空')
  } else {
    AllSizeNo12.value = true
    styleColorQueryParms.value.styleNo = formList1.value[0].inputValue
    styleColorQueryMethods()
  }
}

const FullCodeUsageDataMethodsTableDateLsi1t = ref([])

const AllSizeNo12 = ref(false)

// 型体配色查询
const styleColorQueryParms = ref<any>({
  styleNo: ''
})

const styleColorQueryMethods = async () => {
  try {
    const result = await styleColorQuery(styleColorQueryParms.value)
    FullCodeUsageDataMethodsTableDateLsi1t.value = result.list
  } catch (error) {
    JMessage.error('颜色名称代号查询出错')
  }
}

// 序号变更
const AllSizeNo1 = ref(false)

const AllSizeNo13 = ref()

const newSeqNo = ref()

const Launchform20 = (row: any) => {
  console.log(row)
  newSeqNo.value = Number(row[1].inputValue)
}

// 增加明细资料
const TypeColorDataQueryMethodsInterfaceTableDateList = ref<TypeColorDataQueryInterface[]>([])

const findClicked20 = (row: any) => {
  if (row === '确认调整') {
    if (newSeqNo.value === '') {
      JMessage.warning('新序号不可为空')
      return
    }
    console.log(newSeqNo.value)
    const sourceIndex = TypeColorDataQueryMethodsInterfaceTableDateList.value.findIndex((item) => item.seqNo === formList15.value[0].inputValue)

    const targetIndex = TypeColorDataQueryMethodsInterfaceTableDateList.value.findIndex((item) => item.seqNo === newSeqNo.value)
    console.log(TypeColorDataQueryMethodsInterfaceTableDateList.value)
    console.log(sourceIndex,targetIndex)
    if (sourceIndex !== -1 && targetIndex !== -1) {
      const sourceElement = TypeColorDataQueryMethodsInterfaceTableDateList.value[sourceIndex]

      let newDetailData = {
        ...sourceElement,
        seqNo: newSeqNo.value // 新元素的 seqNo 设置为目标元素的 seqNo
      }

      TypeColorDataQueryMethodsInterfaceTableDateList.value.splice(sourceIndex, 1)

      const insertIndex = targetIndex
      TypeColorDataQueryMethodsInterfaceTableDateList.value.splice(insertIndex, 0, newDetailData)

      // 更新 seqNo
      for (let i = 0; i < TypeColorDataQueryMethodsInterfaceTableDateList.value.length; i++) {
        console.log(TypeColorDataQueryMethodsInterfaceTableDateList.value[i].seqNo)
        TypeColorDataQueryMethodsInterfaceTableDateList.value[i].seqNo = Number(i + 1) as any
      }
      
      AllSizeNo1.value = false
    } else {
      JMessage.warning('找不到指定的序号元素')
    }
  }
}

const formList15 = ref([
  {
    type: 'input1',
    inputValue: '',
    inputPlaceholder: '旧序号',
    inputDisabled: true
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '新序号'
  },
  {
    type: 'button',
    checkboxLabel: '确认调整'
  }
])



const selectValChange = (row: any, bull: any) => {
  bull.partName = row
  PositionDetailQueryMethodsParms.value.partName = row
  PositionDetailQueryMehtods(bull)
}

// 全码用量资料
const AllSizeNo = ref(false)

const formList = ref([
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '型体查询'
  }
])

// 增加全码用量
const addSize = () => {
  FullCodeUsageDataMethodsTableDateLsit.value.push({ sizeFrom: '', mtlUsage: '', change: 'Y', disableConfirm: 'true' })
}

// 删除全码用量
const deleteSizeNo = () => {
  if (listValueDate.value.length === 0) {
    JMessage.warning('请选择需要删除全码用量数据')
  } else {
    handleCloseMateriaLKlcLtvCodeUsage()
  }
}

const ubdatesizeNo = () => {
  UpdateFullCodeUsageMethods()
}

const formList1 = ref([
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '型体查询'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '订单号'
  },
  {
    type: 'button',
    checkboxLabel: '查询'
  },
  {
    type: 'button',
    checkboxLabel: '新增'
  },
  {
    type: 'button',
    checkboxLabel: '检核',
    bgColor: '#1890FF'
  },
  {
    type: 'button',
    checkboxLabel: '取消检核',
    bgColor:'#1890FF',
  },
  {
    type: 'button',
    checkboxLabel: '注意事项建档',
    buttonWidth: '100px'
  },
  {
    type: 'button',
    checkboxLabel: '置空',
    bgColor: '#1890FF'
  }
  // {
  //   type: 'button',
  //   checkboxLabel: '保存',bgColor:'#1890FF',
  // },
  // {
  //   type: 'button',
  //   checkboxLabel: '检核',
  //   bgColor:'#1890FF',
  // },

  // {
  //   type: 'button',
  //   checkboxLabel: '颜色代码更新',
  // },
])

const formListLeft = ref([
  // {
  //     type: 'input',
  //     inputValue: '',
  //     inputPlaceholder: '型体查询',
  //   },
  //   {
  //     type: 'input',
  //     inputValue: '',
  //     inputPlaceholder: '颜色名称',
  //   },
  //   {
  //     type: 'input',
  //     inputValue: '',
  //     inputPlaceholder: '颜色代号',
  //   },
  //   {
  //     type: 'button',
  //     checkboxLabel: '查询',
  //   },
  //   {
  //     type: 'button',
  //     checkboxLabel: '新增',
  //   },
  //   {
  //     type: 'button',
  //     checkboxLabel: '置空',bgColor:'#1890FF',
  //   },
  {
    type: 'button',
    checkboxLabel: '保存',
    bgColor: '#1890FF',
    buttonWidth: '90px'
  },
  {
    type: 'button',
    checkboxLabel: '检核',
    bgColor: '#1890FF',
    buttonWidth: '90px'
  },
  {
    type: 'button',
    checkboxLabel: '取消检核',
    bgColor: '#1890FF',
    buttonWidth: '90px'
  },
  {
    type: 'button',
    checkboxLabel: '颜色代码更新',
    buttonWidth: '90px'
  }
])

const formList2 = ref([
  {
    type: 'button',
    checkboxLabel: '增加明细资料',
    buttonWidth: '100px'
  },
  {
    type: 'button',
    checkboxLabel: '删除打勾记录',
    buttonWidth: '100px'
  },
  {
    type: 'button',
    checkboxLabel: 'BOM表导出',
    buttonWidth: '100px'
  },
  {
    type: 'button',
    checkboxLabel: '用量明细查询',
    buttonWidth: '100px',
    disabled:true
  },
  {
    type: 'button',
    checkboxLabel: '重排序号',
    buttonWidth: '100px'
  },
  {
    type: 'button',
    checkboxLabel: '选择材料',
    bgColor: '#1890FF',
    buttonWidth: '110px'
  },
  {
    type: 'button',
    checkboxLabel: '贴合材料处理',
    bgColor: '#1890FF',
    buttonWidth: '100px'
  },
  // {
  //   type: 'button',
  //   checkboxLabel: '复制用量',
  //   buttonWidth:'120px'
  // },
  {
    type: 'button',
    checkboxLabel: '用量变更查询',
    buttonWidth: '110px',
  },
  {
    type: 'button',
    checkboxLabel: '保存资料',
    buttonWidth:'120px'
  },
])

const formList3 = ref([
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '型体'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '颜色'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '材料名称'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '材料颜色'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '部位'
  },
  {
    type: 'select',
    selectValue: '',
    selectP: '分类',
    selectLabel: '',
    selectOptions: []
  },
  {
    type: 'button',
    checkboxLabel: '置空',
    bgColor: '#1890FF'
  }
])

const formList5 = ref([
  {
    type: 'button',
    checkboxLabel: '保存'
  }
])

const formList6 = ref([
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '编码'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '材料名称1'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '材料名称2'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '材料名称3'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '颜色'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '供应商'
  },
  {
    type: 'button',
    checkboxLabel: '置空',
    bgColor: '#1890FF'
  },
  {
    type: 'button',
    checkboxLabel: '删除正式材料'
  }
])

const formList7 = ref([
  {
    type: 'select',
    selectValue: '',
    selectP: '色系',
    selectOptions: [
    {
        optionKey: '1',
        optionValue: '单色系',
        optionLabel: '单色系'
      },
      {
        optionKey: '2',
        optionValue: '插色系',
        optionLabel: '插色系'
      },
    ]
  },
  {
    type: 'input',
    inputPlaceholder: '颜色',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: 'PANTONE',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '颜色(英)',
    inputValue: ''
  },
  {
    type: 'button',
    checkboxLabel: '搜索',
    bgColor: '#1890FF'
  },
  {
    type: 'button',
    checkboxLabel: '置空',
    bgColor: '#1890FF'
  },
])

const formList8 = ref([
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '型体'
  }
])

const formList9 = ref([
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '序号',
    inputDisabled: true
  },
  {
    type: 'select',
    selectValue: '',
    selectP: '部位',
    selectOptions: []
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '分段'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '物料编码'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '材料颜色'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '材料名称'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '规格'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '单位'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '尺码起'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '尺码止'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '用量'
  },
  {
    type: 'select',
    selectValue: '',
    selectP: '计算方式',
    selectOptions: []
  },
  {
    type: 'select',
    selectValue: '',
    selectP: '领用单位',
    selectOptions: []
  },
  {
    type: 'select',
    selectValue: '',
    selectP: '号码类型',
    selectOptions: []
  },
  {
    type: 'select',
    selectValue: '',
    selectP: '主辅料',
    selectOptions: []
  },
  {
    type: 'button',
    checkboxLabel: '保存'
  }
])

const formList10 = ref([
  {
    type: 'input',
    inputPlaceholder: '请输入物料编码',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入名称',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入名称2',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入名称3',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入颜色',
    inputValue: ''
  },
  {
    type: 'select',
    selectValue: '',
    selectP: '请选择供应商',
    selectOptions: []
  },
  {
    type: 'button',
    checkboxLabel: '组成贴合材料'
  },
  {
    type: 'button',
    checkboxLabel: '插入贴合材料'
  },
  // {
  //   type: 'button',
  //   checkboxLabel: '物料属性定义'
  // },
  {
    type: 'button',
    checkboxLabel: '删除插入贴合材料'
  },
  // {
  //   type: 'button',
  //   checkboxLabel: '上移'
  // },
  // {
  //   type: 'button',
  //   checkboxLabel: '下移'
  // },
  {
    type: 'button',
    checkboxLabel: '插入材料'
  },
  {
    type: 'button',
    checkboxLabel: '置空',
    bgColor: '#1890FF'
  },
])

const formList11 = ref([
  {
    type: 'select',
    selectValue: '',
    selectP: '色系',
    selectOptions: []
  },
  {
    type: 'input',
    inputPlaceholder: '颜色',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: 'PANTONE',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '颜色(英)',
    inputValue: ''
  },
  {
    type: 'button',
    checkboxLabel: '搜索',
    bgColor: '#1890FF'
  },
  {
    type: 'button',
    checkboxLabel: '置空',
    bgColor: '#1890FF'
  },
  {
    type: 'button',
    checkboxLabel: '颜色定义'
  }
])

// 贴合子材料明细修改
const listArrayDate = ref()

const mtlNoYes = ref()

const change10 = (row: any, list: any) => {
  ElMessageBox.confirm('请确认要修改当前记录的是否请购标志吗？')
    .then(async () => {
      confirmChange10(list)
    })
    .catch(() => {
      list.purFlag = !list.purFlag
      list = list
    })
}

const confirmChange10 = async (row: any) => {
  row.mtlNo = mtlNoYes.value
  row.purFlag = row.purFlag ? 0 : 1
  listArrayDate.value = row.purFlag
  const result = await LoginWork.post<any, any>(`/usage/getDetailsOfAdhesiveSubMaterialsUpdate/${listArrayDate.value}`, row)
  if (result.code === 200) {
    // LaminatedSubmaterialMethods()
    JMessage.success(result.msg)
  } else {
    // LaminatedSubmaterialMethods()
    JMessage.error(result.msg)
  }
}
// 插入材料

const currentRow18 = (row: any) => {
  InsertTheBondingMaterialMethodsListAParms.value.mtlId = row.id
  ProductionOfOfficialMaterialsMethodsParms.value.mtlId = row.id
}

const InsertTheBondingMaterialMethodsListAParms = ref<any>({
  id: "",
  mtlColor: "",
  mtlId: 0,
  orderId: "",
  partName: "",
  segment: 0,
  seqNo: 0,
  styleColor: "",
  styleNo: ""
})

const InsertTheBondingMaterialMethodsListA = async () => {
  const result = await InsertTheBondingMaterial(InsertTheBondingMaterialMethodsListAParms.value)
  if (result.code === 200) {
    dialogVisible3.value = false

    TypeColorDataQueryMethods()
    JMessage.success(result.msg)
  } else {
    JMessage.error(result.msg)
  }
}

// 贴合材料处理
const drawer10 = ref(false)

// 颜色修改
const currentRowToclk15 = (row: any) => {
  const { colorName } = row
  modificationColor.value.mtlColor = colorName
  confirmChange5(modificationColor.value)
  drawer10.value = false
}

// 贴合材料建档列表添加
const MethodOfBondingAddParmsList = ref<any>({
  id:0,
  choose:''
})

const MethodOfBondingAdd = async () => {
  const result = await ListOfFitAddList(MethodOfBondingAddParmsList.value)
  if (result.code === 200) {
    JMessage.success(result.msg)
    MethodOfBondingMaterial()
  } else {
    JMessage.error(result.msg)
  }
}

const handleCloseMateriaLKlc20 = (_done?: () => void) => {
  ElMessageBox.confirm('确定要插入子材料吗?')
    .then(async () => {
      MethodOfBondingAdd()
    })
    .catch(() => {})
}

// 双击添加
const currentRow17 = (row: any) => {
  MethodOfBondingAddParmsList.value.choose = 0
  MethodOfBondingAddParmsList.value.id = row.id
  handleCloseMateriaLKlc20()
}

const currentRow23 = (row: any) => {
  MethodOfBondingAddParmsList.value.choose = 1
  MethodOfBondingAddParmsList.value.id = row.id
  handleCloseMateriaLKlc20()
}

const Launchform15 = (row: any) => {
  // isLoading3.value = true
  ColorAcquisitionParms.value.colorSystem = row[0].selectValue
  ColorAcquisitionParms.value.colorName = row[1].inputValue
  ColorAcquisitionParms.value.pantone = row[2].inputValue
  ColorAcquisitionParms.value.engColor = row[3].inputValue
  // ColorAcquisition()
}

const modificationColor = ref<any>()

const currentRow15 = (row: any) => {
  drawer10.value = true
  ColorAcquisition()
  colourCchemeMethods()
  modificationColor.value = row
}

const findData15 = (find: string) => {
  if (find === '颜色定义') {
    router.push({
      path: '/ControlDepartment/MaterialManagement/ColorAttributeDefinition'
    })
  }
  if (find.trim() === '置空') {
    clearFormList2()
  }
  if (find.trim() === '搜索') {
    ColorAcquisition()
  }
}

const choose = ref()

const Vendor = ref<any>()

const TopGoBootom = async () => {
  if (idList.value === undefined) {
    JMessage.warning('请选择需要移动的行')
  } else {
    const result = await Fluctuation(choose.value, idList.value)
    if (result.code === 200) {
      MethodOfBondingMaterial()
      JMessage.success(result.msg)
    } else {
      JMessage.error(result.msg)
    }
  }
}

// 修改贴合材料

const confirmChange5 = async (row?: any) => {
  
  const colorParam = encodeURIComponent(row.mtlColor)
  const result1 = await service.get<any, any>(`/mes/kfBom/checkColor?colorName=${colorParam}`)
  if (result1.code !== 200) {
    row.mtlColor = ''
    JMessage.error(result1.msg)
    return
  }else{
    row.vendor = row.vendor.selectValue
    row.prdType = row.prdType.selectValue
    row.purFlag = row.purFlag === true ? 'Y' : ''
    const result = await service.put<any, any>('/mes/kfBom/updateMtlTemp', row)
    if(result.code === 200) {
      row.mtlColor = row.mtlColor
      row.vendor = {
          selectValue: row.vendor || '',
          options: Vendor.value.map((item1: any, index: any) => {
            if (item1 === null) return
            return {
              label: item1,
              value: `${item1}`,
            }
          })
        }
        row.prdType = {
          selectValue: row.prdType || '',
          options: FitProcessingMethodTableDateList.value!.map((item1: any, index: any) => {
            if (item1 === null) return
            return {
              label: item1.prdType,
              value: item1.prdType,
              LeftLabel: item1.prdType
            }
          })
        }
      }

      if (row.purFlag === 'Y') {
        row.purFlag = true
      }
    
  }
  ProductionOfOfficialMaterialsMethodsParms.value.colorCode = result1.data.colorCode
}

// 删除插入贴合材料方法
const change = async (row: any, prop: any) => {
  delete prop.change
  prop.purFlag = prop.purFlag === true ? 'Y' : ''
  prop.vendor = prop.vendor.selectValue.split(' ')[1]
  prop.prdType = prop.prdType.selectValue
  const result = await LoginWork.put<any, any>('/date/getCacheUpdate', prop)
  if (result.code === 200) {
    JMessage.success(result.msg)
    MethodOfBondingMaterial()
  } else {
    JMessage.error(result.msg)
  }
}

const TheFitMaterialIsRemovedDeleteParms = ref<any>('')

const handleCloseMateriaLKlc1 = (_done?: () => void) => {
  ElMessageBox.confirm('确定要删除该插入贴合材料吗?')
    .then(async () => {
      TheFitMaterialIsRemoved()
    })
    .catch(() => {})
}

const TheFitMaterialIsRemoved = async () => {
  const result = await FitMaterialProfileDeleted(TheFitMaterialIsRemovedDeleteParms.value)
  if (result.code === 200) {
    TheFitMaterialIsRemovedDeleteParms.value = ''
    JMessage.success(result.msg)
    MethodOfBondingMaterial()
  } else {
    JMessage.error(result.msg)
  }
}

// 上下移动
const idList = ref()

const currentRow = (row: any) => {
  const { id } = row
  TheFitMaterialIsRemovedDeleteParms.value = id
  idList.value = id
}

const isLoading2 = ref(true)

const isLoading = ref(true)

const isLoading1 = ref(true)

// 贴合材料建档列表

// 获取厂商
const ObtainVendorParms = ref({
  vendorNo: "",
})
const ObtainVendorTableDateList = async () => {
  const result = await ObtainVendor(ObtainVendorParms.value)
  if (result.code === 200) {
    Vendor.value = result.rows
    MethodOfBondingMaterial()
  }
}

// 获取贴合加工方式
const FitProcessingMethodTableDateList = ref<FitProcessingMethodInterface[]>()

const FitProcessing = async () => {
  const result = await FitProcessingMethod()
  FitProcessingMethodTableDateList.value = result.rows
}

const NeaArrayList = ref<any>()

const MethodOfBondingMaterialTableDateList = ref<any[]>()

const MethodOfBondingMaterial = async () => {
  isLoading2.value = true
  const result = await ListOfFitMaterials()
  if (result.data.length !== 0) {
    MethodOfBondingMaterialTableDateList.value = result.data.map((item: any) => {
      if (Vendor.value) {
        item.vendor = {
          selectValue: item.vendor || '',
          options: Vendor.value.map((item1: any, index: any) => {
            if (item1 === null) return
            return {
              label: item1,
              value: `${item1}`,
            }
          })
        }
      }

      if (FitProcessingMethodTableDateList.value) {
        item.prdType = {
          selectValue: item.prdType || '',
          options: FitProcessingMethodTableDateList.value!.map((item1: any, index: any) => {
            if (item1 === null) return
            return {
              label: item1.prdType,
              value: item1.prdType,
              LeftLabel: item1.prdType
            }
          })
        }
      }

      if (item.purFlag === 'Y') {
        item.purFlag = true
      }
      item.change = 'Y'
      item.disableConfirm = true
      return item
    })
    if (MethodOfBondingMaterialTableDateList.value.length !== 0) {
      mtlNoListy.value = MethodOfBondingMaterialTableDateList.value[0].mtlNo
      // colorCodety.value = MethodOfBondingMaterialTableDateList.value[0].colorCode
    }
    NeaArrayList.value = MethodOfBondingMaterialTableDateList.value
  } else {
    MethodOfBondingMaterialTableDateList.value = []
  }
  isLoading2.value = false
}

const InputDateList = ref({
  input1: '',
  input2: '',
  input3: '',
  input4: ''
})

const options = ref()

// 单位定义
const UnitDefinitionAddList = async () => {
  const result = await UnitDefinition()
  options.value = result.rows
}

const clearFormList11 = () => {
  formList10.value.forEach((item) => {
    if (item.type === 'input') {
      item.inputValue = ''
    }
    if (item.type === 'select') {
      item.selectValue = ''
    }
  })
}

const clearFormList15 = () => {
  formList1.value.forEach((item) => {
    if (item.type === 'input') {
      item.inputValue = ''
    }
  })
  formList.value[0].inputValue = ''
}

const router = useRouter()

// 组成贴合材料
const MaterialsMathods = async () => {
  const result = await TheCompositeMaterialIsFormed()

  if (result.code === 200) {
    MethodOfBondingMaterial()
    JMessage.success(result.msg)
    InputDateList.value.input1 = result.data.mtlName
    InputDateList.value.input2 = result.data.mtlColor
    InputDateList.value.input3 = result.data.mtlSpec
    InputDateList.value.input4 = result.data.mtlUnit
  } else {
    JMessage.error(result.msg)
  }
}

const InsertTheBondingMaterialMethodsParms = ref<any>({
  ids: [],
  cacheVoRequests: []
})

const mtlNoListy = ref('')
const colorCodety = ref('')

const InsertTheBondingMaterialList1Parms = ref<any>({
  colorCopyTemp: "",
  companyId: "",
  deptId: 0,
  drawDept: "",
  id: "",
  isTest: "",
  mtlColor: "",
  mtlName: "",
  mtlNo: "",
  mtlProperty: "",
  mtlSpec: "",
  mtlTypeNo:"" ,
  mtlUnit: "",
  noLotUsage: "",
  orderId: "",
  orderIdCopyTemp: "",
  partName: "",
  phone:"" ,
  process: "",
  remark: "",
  segment: 0,
  seqNo: 0,
  size1: "",
  size2: "",
  sizeType: "",
  styleColor: "",
  styleCopyTemp: "",
  styleNo: "",
  usage: 0,
  usageType:"" ,
  vendor: "",
  vendorType: ""
})

const InsertTheBondingMaterialMethods = async () => {

  const result = await InsertTheBondingMaterialList1(InsertTheBondingMaterialList1Parms.value as any)
  if (result.code === 200) {
    MethodOfBondingMaterial()
    TypeColorDataQueryMethods()
    FormalMaterialsAndMethodsForDevelopingMaterials()
    dialogVisible3.value = false
    ;(InputDateList.value.input1 = ''), (InputDateList.value.input2 = ''), (InputDateList.value.input3 = ''), (InputDateList.value.input4 = '')
    JMessage.success(result.msg)
  } else {
    JMessage.error(result.msg)
  }
}

const findData = (find: string) => {
  if (find === '保存') {
    LaminatedMaterialFileMethods()
  }
  if (find === '置空') {
    clearFormList11()
  }
  if (find === '物料属性定义') {
    router.push({
      path: '/ControlDepartment/MaterialManagement/MaterialAttributeDefinition'
    })
  }
  if (find === '删除插入贴合材料') {
    if (TheFitMaterialIsRemovedDeleteParms.value !== '') {
      handleCloseMateriaLKlc1()
    } else {
      JMessage.warning('请选择需要删除的数据')
    }
  }
  if (find === '上移') {
    choose.value = 0
    TopGoBootom()
  }
  if (find === '下移') {
    choose.value = 1
    TopGoBootom()
  }
  if (find === '组成贴合材料') {
    if (MethodOfBondingMaterialTableDateList.value?.length !== 0) {
      MaterialsMathods()
      UnitDefinitionAddList()
    } else {
      JMessage.warning('请选择正确的贴合材料建档')
    }
  }

  if (find === '插入贴合材料') {
    if (InputDateList.value.input1 !== '' || InputDateList.value.input2 !== '' || InputDateList.value.input3 !== '') {
      InsertTheBondingMaterialMethods()
    } else {
      JMessage.warning('请选择正确的贴合材料建档')
    }
  }

  if (find === '插入材料') {
    InsertTheBondingMaterialMethodsListA()
  }
}

const Launchform11 = (row: any) => {
  isLoading.value = true
  isLoading1.value = true
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlNo = row[0].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlName = row[1].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlName2 = row[2].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlName3 = row[3].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlColor = row[4].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.vendor = row[5].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterials()
}

const VendorDataShow = async () => {
  const result = await VendorData()
  let NewArray1 = []
  NewArray1 = result.vendor.reduce((arr: any, item: any) => {
    if (item.vendorNo && item.vendorName) {
      // 只添加非空的 typeName 和 typeNo
      arr.push(item.vendorNo + ' ' + item.vendorName)
    }
    return arr
  }, [])

  formList10.value[3].selectOptions = EvaluatesTheArrayReturnValue(NewArray1)
}

// 型体颜色下拉框
const vableState = ref(0)

const selectListShow = (row?: any, visible?: boolean) => {
  if (vableState.value === 1) {
    if (visible === true) {
      if (row !== undefined) {
        // row.partName = {
        //   selectValue: row.partName.selectValue,
        //   options: listanyTableDateSelect,
        //   PageModule: true,
        //   total: totalListpartName,
        //   handleSizeChange: (val: any) => {
        //     PositionDetailQueryMethodsParms.value.pageNum = val
        //     PositionDetailQueryMehtods()
        //   },
        //   handleCurrentChange: (val: any) => {
        //     PositionDetailQueryMethodsParms.value.pageNum = val
        //     PositionDetailQueryMehtods()
        //   },
        // }
        // row.vendor = {
        //   selectValue: row.vendor.selectValue,
        //   options: VendorListValue,
        //   PageModule: true,
        //   total: totalListArray,
        //   handleSizeChange: (val: any) => {
        //     GetVendorListListParmsMethods.value.pageNum = val
        //     GetVendorListMethods()
        //   },
        //   handleCurrentChange: (val: any) => {
        //     GetVendorListListParmsMethods.value.pageNum = val
        //     GetVendorListMethods()
        //   },
        // }
        row.usageType = {
          selectValue: row.usageType.selectValue,
          options: [
            { value: '全码', label: '全码' },
            { value: '基本码', label: '基本码' },
            { value: '中间码', label: '中间码' }
          ]
        }
        row.drawDept = {
          selectValue: row.drawDept.selectValue,
          options: [
            { value: '冲裁', label: '冲裁' },
            { value: '外协', label: '外协' },
            { value: '电脑车', label: '电脑车' },
            { value: '针车', label: '针车' },
            { value: '成型', label: '成型' }
          ]
        }
        row.sizeType = {
          selectValue: row.sizeType.selectValue,
          options: [
            { value: '全号', label: '全号' },
            { value: '整号', label: '整号' },
            { value: '半号', label: '半号' }
          ]
        }
        row.mtlProperty = {
          selectValue: row.mtlProperty.selectValue,
          options: [
            { value: '冲裁主料', label: '冲裁主料' },
            { value: '冲裁辅料', label: '冲裁辅料' },
            { value: '针车辅料', label: '针车辅料' }
          ]
        }
      } else {
        if (row.partName === Object) {
          row.partName.options = []
          // row.vendor.options = []
          row.usageType.options = []
          row.drawDept.options = []
          row.sizeType.options = []
          row.mtlProperty.options = []
        }
      }
    }
  } else {
    if (visible === true) {
      if (row !== undefined) {
        // PositionDetailQueryMethodsParms.value.partName = row.partName.selectValue
        // PositionDetailQueryMehtods()
        // row.partName = {
        //   selectValue: row.partName.selectValue,
        //   options: listanyTableDateSelect,
        //   PageModule: true,
        //   total: totalListpartName,
        //   handleSizeChange: (val: any) => {
        //     PositionDetailQueryMethodsParms.value.pageNum = val
        //     PositionDetailQueryMehtods()
        //   },
        //   handleCurrentChange: (val: any) => {
        //     PositionDetailQueryMethodsParms.value.pageNum = val
        //     PositionDetailQueryMehtods()
        //   },
        // }
        // row.vendor = {
        //   selectValue: row.vendor.selectValue,
        //   options: VendorListValue,
        //   PageModule: true,
        //   total: totalListArray,
        //   handleSizeChange: (val: any) => {
        //     GetVendorListListParmsMethods.value.pageNum = val
        //     GetVendorListMethods()
        //   },
        //   handleCurrentChange: (val: any) => {
        //     GetVendorListListParmsMethods.value.pageNum = val
        //     GetVendorListMethods()
        //   },
        // }
        row.usageType = {
          selectValue: row.usageType.selectValue,
          options: [
            { value: '全码', label: '全码' },
            { value: '基本码', label: '基本码' },
            { value: '中间码', label: '中间码' }
          ]
        }
        row.drawDept = {
          selectValue: row.drawDept.selectValue,
          options: [
            { value: '冲裁', label: '冲裁' },
            { value: '外协', label: '外协' },
            { value: '电脑车', label: '电脑车' },
            { value: '针车', label: '针车' },
            { value: '成型', label: '成型' }
          ]
        }
        row.sizeType = {
          selectValue: row.sizeType.selectValue,
          options: [
            { value: '全号', label: '全号' },
            { value: '整号', label: '整号' },
            { value: '半号', label: '半号' }
          ]
        }
        row.mtlProperty = {
          selectValue: row.mtlProperty.selectValue,
          options: [
            { value: '冲裁主料', label: '冲裁主料' },
            { value: '冲裁辅料', label: '冲裁辅料' },
            { value: '针车辅料', label: '针车辅料' }
          ]
        }
      }
    } else {
      if (row !== undefined && row.partName === Object) {
        row.partName.options = []
        // row.vendor.options = []
        row.usageType.options = []
        row.drawDept.options = []
        row.sizeType.options = []
        row.mtlProperty.options = []
      }
    }
  }
}

// 用量明细置空
const findClicked10 = (row: any) => {
  if (row === '置空') {
    clearFormList10()
  }
}

const clearFormList10 = () => {
  formList3.value.forEach((item) => {
    if (item.type === 'input') {
      item.inputValue = ''
    }
    if (item.type === 'select') {
      item.selectValue = ''
    }
  })
}

// 厂商获取
const EvaluatesTheArrayReturnValue1 = (ArrayList: any) => {
  return ArrayList.map((item: any, index: any) => {
    return {
      value: item,
      label: item
    }
  })
}

const GetVendorListListParmsMethods = ref<GetVendorListListParms>({
  pageNum: 1,
  pageSize: 40
})

const VendorListValue = ref([])

const GetVendorListMethods = async () => {
  let NewArray = []
  const result = await GetVendorList(GetVendorListListParmsMethods.value)
  NewArray = result.dtos.reduce((arr: any, item: any) => {
    if (item.vendorNo && item.vendorName) {
      // 只添加非空的 typeName 和 typeNo
      arr.push(item.vendorNo + ' ' + item.vendorName)
    }
    return arr
  }, [])
  // AddDetailData.value.vendor.options = EvaluatesTheArrayReturnValue1(NewArray)
  VendorListValue.value = EvaluatesTheArrayReturnValue1(NewArray)
  totalListArray.value = result.total
  selectListShow()
}

const totalListArray = ref(0)

const totalListpartName = ref(0)

const AddDetailData = ref({
  seqNo: '',
  // partName: {
  //   selectValue: '',
  //   options: [],
  //   PageModule: true,
  //   total: totalListpartName,
  //   handleSizeChange: (val: any) => {
  //     PositionDetailQueryMethodsParms.value.pageNum = val
  //     PositionDetailQueryMehtods()
  //   },
  //   handleCurrentChange: (val: any) => {
  //     PositionDetailQueryMethodsParms.value.pageNum = val
  //     PositionDetailQueryMehtods()
  //   },
  // },
  segment: '',
  mtlNo: '',
  mtlColor: '',
  mtlName: '',
  mtlSoec: '',
  mtlUnit: '',
  size1: '',
  size2: '',
  // vendor: {
  //   selectValue: '',
  //   options: [],
  //   PageModule: true,
  //   total: totalListArray,
  //   handleSizeChange: (val: any) => {
  //     GetVendorListListParmsMethods.value.pageNum = val
  //     GetVendorListMethods()
  //   },
  //   handleCurrentChange: (val: any) => {
  //     GetVendorListListParmsMethods.value.pageNum = val
  //     GetVendorListMethods()
  //   },
  // },
  usage: '',
  usageType: '',
  drawDept: '',
  sizeType: '',
  mtlProperty: '',
  noLotUsage: '',
  remark: '',
  disableConfirm: true,
  change: 'Y'
})

// 部位明细
const PositionDetailQueryMethodsParms = ref<PositionDetailQueryPamrs>({
  engPartName: '',
  pageNum: 1,
  pageSize: 40,
  partName: '',
  seqNo: ''
})

const listanyTableDateSelect = ref([])

const PositionDetailQueryMehtods = async (row?: any) => {
  let NewArray = []
  const result = await PositionDetailQuery(PositionDetailQueryMethodsParms.value)
  if (result.total === 0) {
    JMessage.error('暂无该部位')
    row.partName = ''
    return
  }
  // NewArray = result.partList.reduce((arr: any, item: any) => {
  //   if (item.partName) { // 只添加非空的 typeName 和 typeNo
  //     arr.push(item.partName);
  //   }
  //   return arr;
  // }, []);
  // AddDetailData.value.partName.options = EvaluatesTheArrayReturnValue1(NewArray)
  // listanyTableDateSelect.value = EvaluatesTheArrayReturnValue1(NewArray)
  totalListpartName.value = result.total
}

// 复制用量
const ReplicationDosageMethodsParms = ref<any>([])

const selectedList12 = (row: any) => {
  ReplicationDosageMethodsParms.value = row.map((item: any) => {
    return item
  })
}

const ReplicationDosageMethods = async () => {
  const result = await LoginWork.post<any, any>(`/usage/getCopyingDosage`, {
    currentStyleColor: UsageChangeQueryMethodsParms.value.styleColor,
    currentStyleNo: UsageChangeQueryMethodsParms.value.styleNo,
    list: ReplicationDosageMethodsParms.value
  })
  if (result.code === 200) {
    dialogVisible5.value = false
    JMessage.success(result.msg)
  } else {
    dialogVisible5.value = false
    JMessage.error(result.msg)
  }
}

// 复制用量查询列表
const dialogVisible5 = ref(false)

const ReplicationVolumeQueryTableDateList = ref<any>({
  list: []
})

const totalActiveList = ref(0)

const Launchform10 = (row: any) => {
  ReplicationVolumeQueryTableDateListParms.value.styleNo = row[0].inputValue
  ReplicationVolumeQuery()
}

const ReplicationVolumeQueryTableDateListParms = ref<any>({
  pageNum: 1,
  pageSize: 20,
  styleNo: ''
})

const ReplicationVolumeQuery = async () => {
  const result = await LoginWork.post<any, any>(
    `/usage/getCopyingDosageList`,
    Object.assign(
      {},
      { currentStyleColor: UsageChangeQueryMethodsParms.value.styleColor, currentStyleNo: UsageChangeQueryMethodsParms.value.styleNo },
      ReplicationVolumeQueryTableDateListParms.value
    )
  )
  ReplicationVolumeQueryTableDateList.value.list = result.data.list
  totalActiveList.value = result.data.total
}

const handleSizeChangeTkList = (val: number) => {
  ReplicationVolumeQueryTableDateListParms.value.pageNum = val
  ReplicationVolumeQuery()
}

const handleCurrentChangeTkList = (val: number) => {
  ReplicationVolumeQueryTableDateListParms.value.pageNum = val
  ReplicationVolumeQuery()
}

// 删除全码用量
const listValueDate = ref<any>([])

const currentRow10 = (row: any) => {
  listValueDate.value.push(row)
  listValueDate.value = listValueDate.value.map((item: any) => {
    item.segment = UpdateFullCodeUsageMethodsParmsList.value[0].segment
    item.partName = UpdateFullCodeUsageMethodsParmsList.value[0].partNmae
    return item
  })
}

const DeleteTheFullCodeUsage = async () => {
  if (cfmFlagList.value === 'Y') {
    JMessage.warning('已检核不可删除')
  } else {
    const result = await LoginWork.post<any, any>('/usage/getFullCodeDetailDel', {
      styleColor: UsageChangeQueryMethodsParms.value.styleColor,
      styleNo: UsageChangeQueryMethodsParms.value.styleNo,
      list: listValueDate.value
    })
    if (result.code === 200) {
      TypeQueryMethods()
      listValueDate.value = []
      JMessage.success(result.msg)
    } else {
      TypeQueryMethods()
      listValueDate.value = []
      JMessage.error(result.msg)
    }
  }
}

const handleCloseMateriaLKlcLtvCodeUsage = (_done?: () => void) => {
  ElMessageBox.confirm('确定要删除该数据吗')
    .then(async () => {
      DeleteTheFullCodeUsage()
    })
    .catch(() => {})
}

// 整单型体颜色删除
const WholeBodyColor = async () => {
  if (cfmFlagList.value === 'Y') {
    JMessage.warning('已检核不可删除')
  } else {
    const result = await LoginWork.post<any, any>('/developmentUsage/getDeleteStyleColorList', {
      styleColor: UsageChangeQueryMethodsParms.value.styleColor,
      styleNo: UsageChangeQueryMethodsParms.value.styleNo,
      orderId: UsageChangeQueryMethodsParms.value.orderId
    })
    if (result.code === 200) {
      TypeQueryMethods()
      JMessage.success(result.msg)
    } else {
      TypeQueryMethods()
      JMessage.error(result.msg)
    }
  }
}

const handleCloseMateriaLKlcLtv = (_done?: () => void) => {
  ElMessageBox.confirm('确定要删除该数据吗')
    .then(async () => {
      WholeBodyColor()
    })
    .catch(() => {})
}

// 重排序号
const cfmFlagList = ref()

const ReorderList = async () => {
 
    const result = await service.post<any, any>('/mes/kfBom/reordering', {
      styleColor: UsageChangeQueryMethodsParms.value.styleColor,
      styleNo: UsageChangeQueryMethodsParms.value.styleNo,
      orderId: UsageChangeQueryMethodsParms.value.orderId
    })
    if (result.code === 200) {
      TypeColorDataQueryMethods()
      JMessage.success(result.msg)
    } else {
      JMessage.error(result.msg)
    }
  
}

// 贴合材料处理
const dialogVisible3 = ref(false)

// 生产正是材料并选择到用量表
const ProductionOfOfficialMaterialsMethodsParms = ref<any>({
  colorCode: '',
  mtlColor: '',
  mtlName: '',
  mtlNo: '',
  mtlSpec: '',
  mtlUnit: '',
  partName: '',
  segment: null,
  seqNo: '',
  styleColor: '',
  styleNo: '',
  vendor: ''
})

const ProductionOfOfficialMaterialsMethods = async () => {
  if (ProductionOfOfficialMaterialsMethodsParms.value.mtlName === '') {
    JMessage.warning('材料名称不可为空')
    return
  }

  if (ProductionOfOfficialMaterialsMethodsParms.value.mtlColor === '') {
    handleCloseMateriaLKlc3()
    return
  }

  resultMethods()
}

const resultMethods = async () => {
  ProductionOfOfficialMaterialsMethodsParms.value.orderId = UsageChangeQueryMethodsParms.value.orderId
  const result = await ProductionOfOfficialMaterials(ProductionOfOfficialMaterialsMethodsParms.value)
  if (result.code === 200) {
    TypeColorDataQueryMethods()
    dialogVisible2.value = false
    vableState.value = 0
    JMessage.success(result.msg)
  } else {
    vableState.value = 0
    JMessage.error(result.msg)
  }
}

const handleCloseMateriaLKlc3 = (_done?: () => void) => {
  ElMessageBox.confirm('请确认材料颜色为空?')
    .then(async () => {
      resultMethods()
    })
    .catch(() => {})
}

const currentRow8 = (row: any) => {
  const { mtlName, mtlSpec, mtlUnit, vendor, mtlNo } = row
  ProductionOfOfficialMaterialsMethodsParms.value.mtlName = mtlName
  ProductionOfOfficialMaterialsMethodsParms.value.mtlSpec = mtlSpec
  ProductionOfOfficialMaterialsMethodsParms.value.mtlUnit = mtlUnit
  ProductionOfOfficialMaterialsMethodsParms.value.vendor = vendor
  ProductionOfOfficialMaterialsMethodsParms.value.mtlNo = mtlNo
  ProductionOfOfficialMaterialsMethodsParms.value.mtlId = row.id
}

// 颜色获取
const clearFormList2 = () => {
  formList7.value.forEach((item) => {
    if (item.type === 'input') {
      item.inputValue = ''
    }
    if (item.type === 'select') {
      item.selectValue = ''
    }
  })
}

const dbClickListColor = () => {
  isListTav.value = false
  ColorAcquisition()
  colourCchemeMethods()
  drawer.value = true
}

const colourCchemeMethods = async () => {
  const result = await colourCcheme()
  formList7.value[0].selectOptions = EvaluatesTheArrayReturnValue(result)
}

const isLoading3 = ref(true)

const drawer = ref(false)

watch(drawer, (newVal, oldVal) => {
  if (drawer.value === false) {
    isListTav.value = true // 当 drawer 的值变化时，将 isListTav 设置为 true
  }
})

const Launchform8 = (row: any) => {
  // isLoading3.value = true
  ColorAcquisitionParms.value.colorSystem = row[0].selectValue
  ColorAcquisitionParms.value.colorName = row[1].inputValue
  ColorAcquisitionParms.value.pantone = row[2].inputValue
  ColorAcquisitionParms.value.engColor = row[3].inputValue
  // ColorAcquisition()
}

const findData1 = (find: string) => {
  if (find === '颜色定义') {
    router.push({
      path: '/ControlDepartment/MaterialManagement/ColorAttributeDefinition'
    })
  }
  if (find === '置空') {
    clearFormList2()
  }
  if (find === '搜索') {
    ColorAcquisition()
  }
}

const ColorAcquisitionParms = ref<any>({
  color: '',
  colorCode: '',
  colorName: '',
  colorSystem: '',
  engColor: '',
  id: 0,
  pantone: '',
  remark: '',
  pageNum: 1,
  pageSize: 40,
})

const ColorAcquisitionTableDateList = ref<chooseAColorInterface>({
  colorSystemList: []
})

const ColorAcquisition = async () => {
  const result = await chooseAColor(ColorAcquisitionParms.value)
  ColorAcquisitionTableDateList.value.colorSystemList = result.rows
  totalKlt.value = result.total!
  isLoading3.value = false
}

const totalKlt = ref(0)

const handleSizeChange2 = (val: number) => {
  isLoading3.value = true
  ColorAcquisitionParms.value.pageNum = val
  ColorAcquisition()
}

const handleCurrentChange2 = (val: number) => {
  isLoading3.value = true
  ColorAcquisitionParms.value.pageSize = val
  ColorAcquisition()
}

const currentRowToclk = (row: any) => {
  const { colorName, colorCode } = row
  ProductionOfOfficialMaterialsMethodsParms.value.mtlColor = colorName
  ProductionOfOfficialMaterialsMethodsParms.value.colorCode = colorCode
  drawer.value = false
}

// 选择当前行正式材料到用量表
const CopyDataMethodsPamrsList = ref({
  mtlNmae: '',
  mtlColor: '',
  mtlSpace: '',
  mtUnit: '',
  vendor: ''
})

const UsageChangeQueryMethodsParms = ref<any>({
  colorCode: '',
  pageNum: 1,
  pageSize: 40,
  styleColor: '',
  styleNo: '',
  orderId:''
})

const currentRow7 = (row: any) => {
  deleteCofficialMethodsParms.value = row.id


  SelectTheCurrentRowToInsertMethodsParms.value.mtlColor = row.mtlColor
  SelectTheCurrentRowToInsertMethodsParms.value.mtlId = row.id
}

const SelectTheCurrentRowToInsertMethodsParms = ref<any>({
  id: "",
  mtlColor: "",
  mtlId: 0,
  orderId: "",
  partName: "",
  segment: 0,
  seqNo: 0,
  styleColor: "",
  styleNo: "",
})

const SelectTheCurrentRowToInsertMethods = async () => {
  if (SelectTheCurrentRowToInsertMethodsParms.value.id === '') {
    JMessage.warning('请选择需要插入的数据')
  } else {
    SelectTheCurrentRowToInsertMethodsParms.value.orderId = UsageChangeQueryMethodsParms.value.orderId
    const result = await SelectTheCurrentRowToInsert(SelectTheCurrentRowToInsertMethodsParms.value)
    if (result.code === 200) {
      TypeColorDataQueryMethods()
      vableState.value = 0
      dialogVisible2.value = false
      JMessage.success(result.msg)
    } else {
      vableState.value = 0
      JMessage.error(result.msg)
    }
  }
}

const clearFormList1 = () => {
  formList6.value.forEach((item) => {
    if (item.type === 'input') {
      item.inputValue = ''
    }
  })
}

const findClicked6 = (count: string) => {
  if (count === '置空') clearFormList1()
  if (count === '转面材材料建档') {
    router.push({
      path: '/ControlDepartment/MaterialManagement/SurfaceMaterialDataFile'
    })
  }
  if (count === '转成型材料建档') {
    router.push({
      path: '/ControlDepartment/MaterialManagement/FormingMaterialFile'
    })
  }
  if (count === '删除正式材料') {
    if (deleteCofficialMethodsParms.value === '') {
      JMessage.warning('请选择需要删除的数据')
    } else {
      handleCloseMateriaLKlc12()
    }
  }
}

// 选择材料
const dialogVisible2 = ref(false)

const Launchform7 = (row: any) => {
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlNo = row[0].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlName = row[1].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlName2 = row[2].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlName3 = row[3].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlColor = row[4].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.vendor = row[5].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterials()
}

// 开发材料
const FormalMaterialsAndMethodsForDevelopingTableDateList = ref<FormalMaterialsAndDevelopmentMaterialsParms>({
  officialMaterials: {
    adhesiveMaterialList: []
  },
  developmentMaterials: {
    developmentMaterialsList: []
  }
})

const FormalMaterialsAndMethodsForDevelopingMaterialsParms = ref<any>({
  companyId: "",
  createBy: "",
  mtlColor: "",
  mtlName: "",
  mtlName2: "",
  mtlName3: "",
  mtlNo: "",
  mtlSpec: "",
  mtlUnit: "",
  publicFlag: "",
  status: "",
  vendor: "",
  pageNum: 1,
  pageSize: 40,
})

const FormalMaterialsAndMethodsForDevelopingMaterials = async () => {
  const result = await FormalMaterialsAndDevelopmentMaterials(FormalMaterialsAndMethodsForDevelopingMaterialsParms.value)
  const result1 = await FormalMaterialsAndDevelopmentMaterials1(FormalMaterialsAndMethodsForDevelopingMaterialsParms.value)
  totalofficial.value = result.total!
  totalExploit.value = result1.total!
  FormalMaterialsAndMethodsForDevelopingTableDateList.value.developmentMaterials.developmentMaterialsList = result.rows
  FormalMaterialsAndMethodsForDevelopingTableDateList.value.officialMaterials.adhesiveMaterialList = result1.rows
}

const totalExploit = ref(0)

const handleSizeChangeExploit = (val: number) => {
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.pageSize = val
  FormalMaterialsAndMethodsForDevelopingMaterials()
}

const handleCurrentChangeExploit = (val: number) => {
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.pageNum = val
  FormalMaterialsAndMethodsForDevelopingMaterials()
}

const totalofficial = ref(0)

const handleSizeChangeofficial = (val: number) => {
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.pageSize2 = val
  FormalMaterialsAndMethodsForDevelopingMaterials()
}

const handleCurrentChangeofficial = (val: number) => {
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.pageNum2 = val
  FormalMaterialsAndMethodsForDevelopingMaterials()
}

// 更新全码用量
const UpdateFullCodeUsageMethodsParms = ref<UpdateFullCodeUsagePamrs>({
  list: [],
  styleColor: '',
  styleNo: ''
})

const UpdateFullCodeUsageMethodsParmsList = ref<any>([])

const partNameList = ref<any>({
  segment: '',
  partNmae: ''
})

const UpdateFullCodeUsageMethods = async () => {
  if (partNameList.value.segment === '') {
    JMessage.warning('还未选择型体颜色材料输入的数据')
  } else {
    UpdateFullCodeUsageMethodsParms.value.list = UpdateFullCodeUsageMethodsParms.value.list.concat(
      FullCodeUsageDataMethodsTableDateLsit.value.map((item: any) => {
        item.segment = partNameList.value.segment
        item.partName = partNameList.value.partNmae
        item.mtlUsage = Number(item.mtlUsage)
        item.sizeFrom = Number(item.sizeFrom)
        delete item.change
        delete item.disableConfirm

        return item
      })
    )

    const result = await UpdateFullCodeUsage({
      styleColor: UsageChangeQueryMethodsParms.value.styleColor,
      styleNo: UsageChangeQueryMethodsParms.value.styleNo,
      list: UpdateFullCodeUsageMethodsParms.value.list.concat(AllListMethodsTableDateList.value)
    })
    if (result.code === 200) {
      // FullCodeUsageDataMethods()
      UpdateFullCodeUsageMethodsParms.value.list = []
      JMessage.success(result.msg)
    } else {
      UpdateFullCodeUsageMethodsParms.value.list = []
      JMessage.error(result.msg)
    }
  }
}

// 复制资料
const dialogVisible1 = ref(false)

const CopyDataMethodsPamrs = ref<any>({
  colorCode: '',
  newColorCode: '',
  newStyleColor: '',
  newStyle: '',
  styleColor: '',
  styleNo: '',
  wantColor: '0',
  newOrderId:'',
  orderId:'',
  newColor:'',
  id:''
})

const CopyDataMethods = async () => {
  const result = await CopyData(CopyDataMethodsPamrs.value)
  if (result.code === 200) {
    CopyDataMethodsPamrs.value.newColorCode = ''
    CopyDataMethodsPamrs.value.newStyleColor = ''
    CopyDataMethodsPamrs.value.newOrderId = ''
    dialogVisible1.value = false
    TypeQueryMethods()
    JMessage.success(result.msg)
  } else {
    JMessage.error(result.msg)
  }
}

const findClicked5 = (row: string) => {
  if (row === '保存') {
    if (CopyDataMethodsPamrs.value.newStyleNo === '' || CopyDataMethodsPamrs.value.newOrderId === '') {
      JMessage.warning('型体和订单号不可为空不')
    } else {
      CopyDataMethods()
    }
  }
}



// 注意事项建档
const PrecautionsFileMethodsParmsDateList = ref([])

const PrecautionsFileMethods = async () => {
  const reuslt = await PrecautionsFileList({
    styleColor: UsageChangeQueryMethodsParms.value.styleColor,
    styleNo: UsageChangeQueryMethodsParms.value.styleNo,
    orderId:UsageChangeQueryMethodsParms.value.orderId
  })
  setTimeout(async () => {
    const result = await PrecautionsFile({
      styleColor: UsageChangeQueryMethodsParms.value.styleColor,
      styleNo: UsageChangeQueryMethodsParms.value.styleNo,
      orderId:UsageChangeQueryMethodsParms.value.orderId,
    })
    PrecautionsFileMethodsParmsDateList.value = result.data.map((item: any) => {
      item.functionRow=[
        {
          label: '删除'
        },
      ]
      item.change = 'Y'
      item.disableConfirm = true
      return item
    })
  }, 1)
}

// 用量变更查询
const drawer5 = ref(false)

const UsageChangeQueryMethodsTableDateList = ref<UsageChangeQueryInterface>({
  list: []
})

const UsageChangeQueryMethods = async () => {
  const result = await UsageChangeQuery(UsageChangeQueryMethodsParms.value)
  UsageChangeQueryMethodsTableDateList.value.list = result.list
}

const totalA = ref(0)

const handleSizeChangeA = (val: number) => {
  UsageChangeQueryMethodsParms.value.pageSize = val
  UsageChangeQueryMethods()
}

const handleCurrentChangeA = (val: number) => {
  UsageChangeQueryMethodsParms.value.pageNum = val
  UsageChangeQueryMethods()
}

const EvaluatesTheArrayReturnValue = (ArrayList: any) => {
  return ArrayList.map((item: any, index: any) => {
    return {
      optionKey: index,
      optionValue: item,
      optionLabel: item
    }
  })
}

// 库存材料
const classifyQueryMethods = async () => {
  let NewArray = []
  const result = await classifyQuery()
  NewArray = result.reduce((arr: any, item: any) => {
    if (item.typeNo && item.typeName) {
      // 只添加非空的 typeName 和 typeNo
      arr.push(item.typeNo + ' ' + item.typeName)
    }
    return arr
  }, [])
  formList3.value[5].selectOptions = EvaluatesTheArrayReturnValue(NewArray)
}

// 全码用量
const currentRow5 = (row: any) => {
  const { styleNo, styleColor, partName, segment } = row
  AllListMethodsParms.value.styleColor = styleColor
  AllListMethodsParms.value.styleNo = styleNo
  AllListMethodsParms.value.partName = partName
  AllListMethodsParms.value.segment = segment
  AllListMethods()
}

const AllListMethodsParms = ref<FullCodeUsageDataParms>({
  styleNo: '',
  styleColor: '',
  partName: '',
  segment: -1
})

const AllListMethodsTableDateList = ref([])

const AllListMethods = async () => {
  const result = await FullCodeUsageData(AllListMethodsParms.value)
  AllListMethodsTableDateList.value = result
}

// 用量明细查询
const drawer3 = ref(false)

const UsageDetailQueryMethodsTableDateList = ref<UsageDetailQueryParmsList>({
  list: []
})

const UsageDetailQueryMethodsParms = ref<UsageDetailQueryPamrsList>({
  mtlColor: '',
  mtlName: '',
  pageNum: 1,
  pageSize: 40,
  partName: '',
  styleColor: '',
  styleNo: '',
  typeName: ''
})

const Launchform5 = (row: any) => {
  UsageDetailQueryMethodsParms.value.styleNo = row[0].inputValue
  UsageDetailQueryMethodsParms.value.styleColor = row[1].inputValue
  UsageDetailQueryMethodsParms.value.mtlName = row[2].inputValue
  UsageDetailQueryMethodsParms.value.mtlColor = row[3].inputValue
  UsageDetailQueryMethodsParms.value.partName = row[4].inputValue

  UsageDetailQueryMethodsParms.value.typeName = row[5].selectValue.split(' ')[1]
  UsageDetailQueryMethods()
}

const loading3 = ref(false)

const UsageDetailQueryMethods = async () => {
  loading3.value = true
  const result = await UsageDetailQuery(UsageDetailQueryMethodsParms.value)
  UsageDetailQueryMethodsTableDateList.value.list = result.list.map((item: any) => {
    if (item.noLotUsage === 'Y') {
      item.noLotUsage = true
    }
    return item
  })
  if (result.list.length > 0) {
    AllListMethodsParms.value.styleColor = result.list[0].styleColor
    AllListMethodsParms.value.styleNo = result.list[0].styleNo
    AllListMethodsParms.value.partName = result.list[0].partName
    AllListMethodsParms.value.segment = result.list[0].segment
    AllListMethods()
  }
  totalList.value = result.total!
  loading3.value = false
}

const totalList = ref(0)

const handleSizeChangeList = (val: number) => {
  UsageDetailQueryMethodsParms.value.pageSize = val
  UsageDetailQueryMethods()
}

const handleCurrentChangeList = (val: number) => {
  UsageDetailQueryMethodsParms.value.pageNum = val
  UsageDetailQueryMethods()
}

// 增加明细资料
const dialogVisible = ref(false)

const findClicked1 = async (row: any) => {
  if (row === '保存资料') {
    RdTypeBodyFileSaveMethods() 
  }
  if (row === '保存修改基本号码') {
    if (ubdateSizeNoMethodsParms.value.baseSize === '') {
      JMessage.warning('型体基本号码不可为空')
    } else {
      ubdateSizeNoMethods()
    }
  }
  if (row === '增加明细资料') {
    if (purFlagList.value) {
      if (tableDateList.value) {
        let newDetailData = { ...AddDetailData.value, isLocal: true }
        let index = TypeColorDataQueryMethodsInterfaceTableDateList.value.findIndex((item) => item.seqNo === tableDateList.value.seqNo)

        if (index !== -1) {
          // 设置新元素的 seqNo
          newDetailData.seqNo = (Number(tableDateList.value.seqNo) + 1) as any

          // 在找到的索引后插入新数据
          TypeColorDataQueryMethodsInterfaceTableDateList.value.splice(index + 1, 0, newDetailData as any)

          // 更新插入位置之后的所有元素的 seqNo
          for (let i = index + 2; i < TypeColorDataQueryMethodsInterfaceTableDateList.value.length; i++) {
            TypeColorDataQueryMethodsInterfaceTableDateList.value[i].seqNo =
              Number(TypeColorDataQueryMethodsInterfaceTableDateList.value[i].seqNo) + 1
          }

          // 调用获取供应商列表方法
          GetVendorListMethods()

          // 调用查询明细资料方法
          PositionDetailQueryMehtods()
        }
      } else {
        // 复制新数据对象
        let newDetailData = { ...AddDetailData.value }

        // 获取列表中已有的最大序号
        let maxSeqNo = Math.max(...TypeColorDataQueryMethodsInterfaceTableDateList.value.map((item: any) => item.seqNo), 0)

        // 设置新数据对象的序号为最大序号加1
        newDetailData.seqNo = (maxSeqNo + 1) as any

        // 将新条目添加到列表中
        TypeColorDataQueryMethodsInterfaceTableDateList.value.push(newDetailData as any)

        // 更新列表数据
        TypeColorDataQueryMethodsInterfaceTableDateList.value = [...TypeColorDataQueryMethodsInterfaceTableDateList.value]

        // 重置查询参数
        PositionDetailQueryMethodsParms.value.engPartName = ''
        // PositionDetailQueryMethodsParms.value.partName = '';
        PositionDetailQueryMethodsParms.value.seqNo = ''

        // 调用获取供应商列表方法
        GetVendorListMethods()

        // 调用查询明细资料方法
        PositionDetailQueryMehtods()
      }
    } else {
      JMessage.warning('已检核的数据不可新增')
    }
  }
  if (row === '用量明细查询') {
    drawer3.value = true
    classifyQueryMethods()
    UsageDetailQueryMethods()
  }
  if (row === '用量变更查询') {
    drawer5.value = true
    UsageChangeQueryMethods()
  }
  if (row === '注意事项建档') {
    PrecautionsFileMethods()
    dialogVisible.value = true
  }
  if (row === '复制资料') {
    dialogVisible1.value = true
  }
  if (row === '删除打勾记录') {
    if (DeleteTheCheckmarkedRecordTypeParms.value.length === 0) {
      JMessage.warning('请选择需要删除的记录')
    } else {
      handleCloseMateriaLKlc()
    }
  }

  if (row === '选择材料') {
    if (purFlagList.value) {
      if (SelectTheCurrentRowToInsertMethodsParms.value.seqNo === '') {
        JMessage.warning('请选择需要修改的数据')
      } else {
        FormalMaterialsAndMethodsForDevelopingMaterials()
        dialogVisible2.value = true
      }
    } else {
      JMessage.warning('已检核的数据不可修改')
    }
  }
  if (row === '贴合材料处理') {
    if (purFlagList.value) {
      if (SelectTheCurrentRowToInsertMethodsParms.value.partName === '') {
        JMessage.warning('请选择需要修改的数据')
      } else {
        // BondingMaterialTreatmentMethods()

        FitProcessing()
        ObtainVendorTableDateList()
        // VendorDataShow()
        FormalMaterialsAndMethodsForDevelopingMaterials()
        UnitDefinitionAddList()
        dialogVisible3.value = true
      }
    } else {
      JMessage.warning('已检核的数据不可修改')
    }
  }
  if (row === '重排序号') {
    ReorderList()
  }
  if (row === '整单型体颜色删除') {
    handleCloseMateriaLKlcLtv()
  }

  if (row === '复制用量') {
    ReplicationVolumeQuery()
    dialogVisible5.value = true
  }

  if (row === 'BOM表导出') {
    // TypeQueryMethodsPamrs1.value.styleNo = TypeQueryMethodsPamrs1.value.style
    const res = (await fileRequest.post(`/mes/kfBom/exportBom`, TypeColorDataQueryMethodsPamrs.value)) as any
    if(res.headers['content-type'] === 'application/json'){
      JMessage.error('开发bom明细导出失败!')
      return
    }else{
      const link = document.createElement('a') // 利用a标签自定义下载文件名
      let blob = new Blob([res.data]) // 创建Blob对象，设置文件类型
      link.style.display = 'none'
      //设置连接
      link.href = window.URL.createObjectURL(blob)
      link.download = `开发用量建档导出${Date.now()}.xls` //自定义文件名字
      document.body.appendChild(link)
      //模拟点击事件
      link.click()
      document.body.removeChild(link)
      }
    

  }

  if (row === '全码用量资料明细') {
    // FullCodeUsageDataMethods()
    AllSizeNo.value = true
  }
}

const numberList = ref<any>([])

const styleNoParms = ref({
  styleNo: '',
  styleColor: '',
  cfmFlag: '',
  orderId:''
})

const loading1 = ref(false)

// 型体备注
const styleColorRemark = ref('')

const saveDateListMethods = async () => {
  const partNameSegments = new Map() // 用于存储每个 partName 的 segment 值
  saveDateListMethodsParms.value.styleColorMaterialRequests = saveDateListMethodsParms.value.styleColorMaterialRequests.filter(
    (item: any) => item.partName
  )

  saveDateListMethodsParms.value.styleColorMaterialRequests.forEach((item: any) => {
    item.partName = item.partName
    // item.drawDept = item.drawDept.selectValue ? item.drawDept.selectValue : '';
    // item.mtlProperty = item.mtlProperty.selectValue ? item.mtlProperty.selectValue : '';
    // item.sizeType = item.sizeType.selectValue ? item.sizeType.selectValue : '';
    // item.usageType = item.usageType.selectValue ? item.usageType.selectValue : '';
    item.vendor = item.vendor
    delete item.isLocal

    // 检查 partName 是否已经存在
    if (partNameSegments.has(item.partName)) {
      // 如果 partName 已存在，segment 在原有基础上增加 1
      item.segment = partNameSegments.get(item.partName) + 1
    } else {
      // 如果 partName 不存在，segment 设置为 0
      item.segment = 0
    }

    // 更新 partName 的 segment 值
    partNameSegments.set(item.partName, item.segment)

    // 检查 usage 是否有效
    if (item.usage === '' || isNaN(item.usage) || item.usage === 0) {
      item.usage = null
    } else {
    }
  })
  saveDateListMethodsParms.value.orderId = TypeColorDataQueryMethodsPamrs.value.orderId
  const result = await saveDateList(saveDateListMethodsParms.value)
  if (result.code === 200) {
    TypeColorDataQueryMethods()
    JMessage.success(result.msg)
  } else {
    JMessage.error(result.msg)
  }
}

// 保存
const saveDateListMethodsParms = ref<any>({
  styleColor: '',
  styleColorMaterialRequests: [],
  styleColorRemark: styleColorRemark.value,
  styleNo: '',
  
})

// 审核取消检核
const FullNnumer = ref()

const FullCodeUsageDataMethodsParms = ref<FullCodeUsageDataParms>({
  partName: '',
  segment: -1,
  styleColor: '',
  styleNo: ''
})

const FullCodeUsageCheckMethodsParms = ref<any>({
  styleColor: '',
  styleNo: ''
})

const FullCodeUsageCheckMethods = async () => {
  FullCodeUsageCheckMethodsParms.value.orderId = TypeColorDataQueryMethodsPamrs.value.orderId
  const result = await FullCodeUsageCheck(FullNnumer.value, FullCodeUsageCheckMethodsParms.value)
  if (result.code === 200) {
    ColorCodePictureMethods()
    JMessage.success(result.msg)
  } else {
    ColorCodePictureMethods()
    JMessage.error(result.msg)
  }
}

// 全码用量资料
const loading2 = ref(false)

const FullCodeUsageDataMethodsTableDateLsit = ref<any>([])

const FullCodeUsageDataMethods = async () => {
  loading2.value = true
  const result = await FullCodeUsageData(FullCodeUsageDataMethodsParms.value)

  if (result.length !== 0 && result.data !== null) {
    FullCodeUsageDataMethodsTableDateLsit.value = result.map((item: any) => {
      item.change = 'Y'
      item.disableConfirm = true
      return item
    })
  }

  loading2.value = false
}

// 贴合子材料明细
const tableDateList = ref()

const mtlNameSpace = ref({
  mtlName: '',
  mtlSpec: '',
  mtlUnit: ''
})
const vendorList = ref('')
const currentTableRow = ref()
const currentRow3 = async (row: any) => {
  // if(row.mtlNo !== ""){
  //   copyDataParms.value.mtlNo = row.mtlNo
  //   vendorList.value = row.vendor
  // }
  copyDataParms.value.id = row.id
  InsertTheBondingMaterialMethodsListAParms.value.partName = row.partName
  InsertTheBondingMaterialMethodsListAParms.value.segment = row.segment
  InsertTheBondingMaterialMethodsListAParms.value.id = row.id
  SelectTheCurrentRowToInsertMethodsParms.value.id = row.id
  InsertTheBondingMaterialList1Parms.value.partName = row.partName
  InsertTheBondingMaterialList1Parms.value.segment = row.segment
  InsertTheBondingMaterialList1Parms.value.seqNo = row.seqNo
  InsertTheBondingMaterialList1Parms.value.mtlNo = row.mtlNo
  InsertTheBondingMaterialList1Parms.value.mtlName = row.mtlName
  InsertTheBondingMaterialList1Parms.value.mtlSpec = row.mtlSpec
  InsertTheBondingMaterialList1Parms.value.mtlUnit = row.mtlUnit
  InsertTheBondingMaterialList1Parms.value.companyId = row.companyId
  InsertTheBondingMaterialList1Parms.value.id = row.id
  ProductionOfOfficialMaterialsMethodsParms.value.id = row.id
  ColorMtl.value = row.mtlColor
  confirmChange20TableDate.value = row
  currentTableRow.value = row
  mtlNameSpace.value.mtlName = row.mtlName
  mtlNameSpace.value.mtlSpec = row.mtlSpec
  mtlNameSpace.value.mtlUnit = row.mtlUnit
  tableDateList.value = row
  mtlNoAny.value = row.mtlNo
  const { mtlNo, segment, partName, seqNo, mtlUnit, mtlColor, mtlName, mtlSpec, vendor } = row
  partNameList.value.partNmae = partName
  partNameList.value.segment = segment
  mtlNoYes.value = mtlNo
  mtlNo1List.value = mtlNo
  // LaminatedSubmaterialMethods()
  FullCodeUsageDataMethodsParms.value.partName = partName
  FullCodeUsageDataMethodsParms.value.segment = segment
  // FullCodeUsageDataMethods()
  UpdateFullCodeUsageMethodsParmsList.value.push({ partName: partName, segment: segment, change: 'Y' })
  SelectTheCurrentRowToInsertMethodsParms.value.seqNo = seqNo
  SelectTheCurrentRowToInsertMethodsParms.value.segment = segment
  SelectTheCurrentRowToInsertMethodsParms.value.partName = partName
  //
  SelectTheCurrentRowToInsertMethodsParms.value.mtlNo = mtlNo

  // const result = await selectMtlName(mtlNameSpace.value)
  // if (result !== null) {
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlUnit = result.mtlUnit
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlName = result.mtlName
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlSpec = result.mtlSpec
  //   ProductionOfOfficialMaterialsMethodsParms.value.vendor = result.vendor
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlNo = result.mtlNo
  // } else {
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlUnit = ''
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlName = ''
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlSpec = ''
  //   ProductionOfOfficialMaterialsMethodsParms.value.vendor = ''
  //   ProductionOfOfficialMaterialsMethodsParms.value.mtlNo = ''
  // }

  ProductionOfOfficialMaterialsMethodsParms.value.partName = partName
  ProductionOfOfficialMaterialsMethodsParms.value.seqNo = seqNo
  ProductionOfOfficialMaterialsMethodsParms.value.segment = segment



  BondingMaterialTreatmentParms.value.mtlColor = mtlColor
  BondingMaterialTreatmentParms.value.mtlName = mtlName
  BondingMaterialTreatmentParms.value.mtlNo = mtlNo
  BondingMaterialTreatmentParms.value.mtlSpec = mtlSpec
  BondingMaterialTreatmentParms.value.mtlUnit = mtlUnit
  BondingMaterialTreatmentParms.value.partName = partName
  BondingMaterialTreatmentParms.value.segment = segment
  BondingMaterialTreatmentParms.value.seqNo = seqNo

  //
  BondingMaterialTreatmentParms.value.vendor = vendor
}

const mtlNo1List = ref()

const LaminatedSubmaterialMethodsTableDateLsit = ref<LaminatedSubmaterialInterface[]>()

// const LaminatedSubmaterialMethods = async () => {
//   loading1.value = true
//   const result = await LaminatedSubmaterial({ mtlNo: mtlNo1List.value })
//   LaminatedSubmaterialMethodsTableDateLsit.value = result.map((item: any) => {
//     if (item.purFlag === 'Y') {
//       item.purFlag = true
//     }
//     if (purFlagList.value) {
//       item.change = 'Y'
//       item.disableConfirm = true
//     }

//     return item
//   })
//   loading1.value = false
// }

// 删除型体
const selectedList = (row: any) => {
  DeleteTheCurrentRowDataPmars.value.seqNoList = row.map((item: any) => {
    return item.seqNo
  })

  seqNoList.value = row.map((item: any) => {
    return item
  })

  DeleteTheCheckmarkedRecordTypeParms.value = row.map((item: any) => {
   return item.id 
  })
}

const seqNoList = ref([])

const DeleteTheCurrentRowDataPmars = ref<DeleteTheCheckmarkedRecordTypePamrs>({
  seqNoList: [],
  styleColor: '',
  styleNo: ''
})

const DeleteTheCheckmarkedRecordTypeParms = ref([])

const DeleteTheCurrentRowData = async () => {  
  if (DeleteTheCurrentRowDataPmars.value.seqNoList.length === 0) {  
    JMessage.warning('请选择要删除的记录');  
    return;  
  }  

  // // 保存两个数组用于分类  
  // const localRecordsToDelete:any = [];  
  // const dbRecordsToDelete = [];  

  // // 遍历勾选的序号，分类到本地数据和数据库数据  
  // DeleteTheCurrentRowDataPmars.value.seqNoList.forEach((seqNo) => {  
  //   const foundRow = TypeColorDataQueryMethodsInterfaceTableDateList.value.find((item) => item.seqNo === seqNo);  
  //   if (foundRow) {  
  //     if (foundRow.isLocal) {  
  //       localRecordsToDelete.push(seqNo);  
  //     } else {  
  //       dbRecordsToDelete.push(seqNo);  
  //     }  
  //   }  
  // });  

  // // 删除本地记录  
  // if (localRecordsToDelete.length > 0) {  
  //   console.log('要删除的本地记录序号:', localRecordsToDelete);  
    
  //   TypeColorDataQueryMethodsInterfaceTableDateList.value = TypeColorDataQueryMethodsInterfaceTableDateList.value.filter(  
  //     (item) => !localRecordsToDelete.includes(item.seqNo)  
  //   );  
    
  //   console.log('更新后的记录:', TypeColorDataQueryMethodsInterfaceTableDateList.value); // 确保记录被更新  
  //   ReorderList();  
  //   JMessage.success('已删除本地记录');  
  // }  

  // 删除数据库中的记录  

    const result = await DeleteTheCheckmarkedRecordType(DeleteTheCheckmarkedRecordTypeParms.value);  

    if (result.code === 200) {  
      // 数据库删除成功后，更新数据  
      TypeColorDataQueryMethods();  
      JMessage.success(result.msg);  
    } else {  
      JMessage.error(result.msg);  
    }  
  

  // 清空选择的序号列表  
  DeleteTheCurrentRowDataPmars.value.seqNoList = [];  
};  

const handleCloseMateriaLKlc = (_done?: () => void) => {
  ElMessageBox.confirm('确定要删除该数据吗')
    .then(async () => {
      DeleteTheCurrentRowData()
    })
    .catch(() => {})
}

// 型体颜色材料输入
const loading = ref(false)

const TypeColorDataQueryMethodsPamrs = ref<any>({
  styleNo: '',
  styleColor: '',
  orderId:''
})

const TypeColorDataQueryMethods = async () => {
  UpdateFullCodeUsageMethodsParmsList.value = []
  loading.value = true
  const reuslt = await TypeColorDataQuery(TypeColorDataQueryMethodsPamrs.value)
  if (reuslt.code === 200) {
    TypeColorDataQueryMethodsInterfaceTableDateList.value = reuslt.data.map((item: any) => {
        if(item.isTest === '0'){
          item.isTest = false 
        }else{
          item.isTest = true
        }
        item.change = 'Y'
        item.disableConfirm = true

      if (item.noLotUsage === 'Y') {
        item.noLotUsage = true
      }
      // console.log(item.isTest)
      // item.isTest = {
      //     selectValue: item.isTest || '',
      //     options: [
      //       {
      //         label: '是',
      //         value: '0'
      //       },
      //       {
      //         label: '否',
      //         value: '1'
      //       },
      //     ]
      // };
      // item.drawDept = {
      //     selectValue: item.drawDept || '',
      //     options: []
      // };
      // item.sizeType = {
      //     selectValue: item.sizeType || '',
      //     options: []
      // };
      // item.mtlProperty = {
      //     selectValue: item.mtlProperty || '',
      //     options: []
      // };
      item.disableConfirm = true
      return item
    })
    if (true) {
      const requiredLength = 40
      const currentLength = TypeColorDataQueryMethodsInterfaceTableDateList.value.length

      // 计算当前最大 seqNo
      const maxSeqNo = TypeColorDataQueryMethodsInterfaceTableDateList.value.reduce((max: any, item: any) => {
        const seqNo = parseInt(item.seqNo, 10) // 将 seqNo 转换为整数
        return seqNo > max ? seqNo : max // 返回最大值
      }, 0) // 初始值为 0

      if (currentLength < requiredLength) {
        const addItem = requiredLength - currentLength

        for (let index = 0; index < addItem; index++) {
          // 复制 AddDetailData 的值并设置 seqNo
          let newDetailData = { ...AddDetailData.value }
          newDetailData.seqNo = (maxSeqNo + index + 1).toString() // 设置 seqNo 为最大值 + index + 1

          // 将新数据添加到列表中
          TypeColorDataQueryMethodsInterfaceTableDateList.value.push(newDetailData as any)
        }
      }
    }

    if (reuslt.data.length > 0) {
      UpdateFullCodeUsageMethodsParmsList.value.push({ partNmae: reuslt.data[0].partName, segment: reuslt.data[0].segment })
      FullCodeUsageDataMethodsParms.value.partName = reuslt.data[0].partName
      FullCodeUsageDataMethodsParms.value.segment = reuslt.data[0].segment
      formList9.value[0].inputValue = reuslt.data.length + 1
      mtlNo1List.value = reuslt.data[0].mtlNo
      mtlNoYes.value = reuslt.data[0].mtlNo
      // FullCodeUsageDataMethods()
      // LaminatedSubmaterialMethods()
    }

    saveDateListMethodsParms.value.styleColorMaterialRequests = TypeColorDataQueryMethodsInterfaceTableDateList.value
  }
  loading.value = false
}
// 新增

const listAdd = async () => {
  // listAddParms.value.colorCode === '' ? listAddParms.value.colorCode : listAddParms.value.colorCode = null
  const reuslt = await service.post<any, any>('/mes/kfBom/head/save', listAddParms.value)
  if (reuslt.code === 200) {
    // listAddParms.value.colorCode = ''
    // listAddParms.value.styleColor = ''
    // listAddParms.value.styleNo = ''
    // formList.value[0].inputValue = ''
    // formList1.value[0].inputValue = ''
    // formList1.value[1].inputValue = ''
    // ColorCodePictureMethodsParms.value.styleColor = ''
    // ColorCodePictureMethodsParms.value.colorCode = ''
    TypeQueryMethods()
    JMessage.success(reuslt.msg)
  } else {
    // listAddParms.value.colorCode = ''
    // listAddParms.value.styleColor = ''
    // listAddParms.value.styleNo = ''
    // ColorCodePictureMethodsParms.value.styleColor = ''
    // ColorCodePictureMethodsParms.value.colorCode = ''
    // formList.value[0].inputValue = ''
    // formList1.value[0].inputValue = ''
    // formList1.value[1].inputValue = ''
    TypeQueryMethods()
    JMessage.error(reuslt.msg)
  }
}

// 左侧表格

// 颜色图片代码
const Launchform1 = (row: any) => {
  TypeQueryMethodsPamrs.value.styleNo = row[0].inputValue
  TypeQueryMethodsPamrs.value.orderId = row[1].inputValue
  listAddParms.value.styleNo = row[0].inputValue
  ColorCodePictureMethodsParms.value.styleNo = row[0].inputValue

  TypeQueryMethodsPamrs1.value.style = row[0].inputValue

  ColorCodePictureMethodsParms.value.colorCode = row[2].inputValue
  ColorCodePictureMethodsParms.value.styleColor = row[1].inputValue
  listAddParms.value.orderId = row[2].inputValue
  listAddParms.value.styleColor = row[1].inputValue
  // ColorCodePictureMethods()
  // TypeColorDataQueryMethods()

  TypeQueryMethodsPamrs1.value.color = row[1].inputValue
  TypeQueryMethodsPamrs1.value.colorCode = row[2].inputValue
}

const imgList = ref<any>([])



const ColorCodePictureMethodsParms = ref<ColorCodePictureParms>({
  colorCode: '',
  pageNum: 1,
  pageSize: 40,
  styleColor: '',
  styleNo: ''
})

const ColorCodePictureMethodsParmsTableDateList = ref<ColorCodePictureTableDate>({
  list: []
})
const indexList = ref()
const currentRow2 = (row: any) => {
  indexList.value = ColorCodePictureMethodsParmsTableDateList.value.list.findIndex((item: any) => item === row)
  imgList.value[0] = row.photoPath
  if (row.cfmFlag !== 'Y') {
    purFlagList.value = true
  } else {
    purFlagList.value = false
  }
 
  image.value = row.photoPath
  formList2.value[11].inputValue = row.remark
  styleNoParms.value.styleColor = row.styleColor
  styleNoParms.value.cfmFlag = row.cfmFlag
  styleNoParms.value.orderId = row.orderId
  FullCodeUsageDataMethodsParms.value.styleColor = row.styleColor
  FullCodeUsageCheckMethodsParms.value.styleColor = row.styleColor
  saveDateListMethodsParms.value.styleColor = row.styleColor
  UsageChangeQueryMethodsParms.value.styleColor = row.styleColor  
  UsageChangeQueryMethodsParms.value.colorCode = row.colorCode
  UsageChangeQueryMethodsParms.value.orderId = row.orderId
  CopyDataMethodsPamrs.value.styleColor = row.styleColor
  CopyDataMethodsPamrs.value.colorCode = row.colorCode  
  CopyDataMethodsPamrs.value.orderId = row.orderId  
  InsertTheBondingMaterialMethodsListAParms.value.colorCode = row.colorCode
  BondingMaterialTreatmentParms.value.styleColor = row.styleColor
  copyDataParms.value.styleColor = row.styleColor
  ubdateSizeNoMethodsParms.value.styleColor = row.styleColor
  // SelectTheCurrentRowToInsertMethodsParms.value.styleColor = row.styleColor
  ProductionOfOfficialMaterialsMethodsParms.value.styleColor = row.styleColor
  TypeColorDataQueryMethods()
  saveDateListMethodsParms.value.styleColorRemark = row.remark
  cfmFlagList.value = row.cfmFlag

  TypeQueryMethodsPamrs1.value.color = row.styleColor
  TypeQueryMethodsPamrs1.value.colorCode = row.colorCode
}

const purFlagList = ref(true)

const isLoading15 = ref(false)

const ColorCodePictureMethods = async () => {
  isLoading15.value = true
  const result = await ColorCodePicture(ColorCodePictureMethodsParms.value)
  if (result.list.length !== 0) {
    ColorCodePictureMethodsParmsTableDateList.value.list = result.list.map((item: any) => {
      if (item.cfmFlag === 'Y') {
        item.backgroundColor = '#80FF00'
        cfmFlagList.value = 'Y'
      } else {
        cfmFlagList.value = null
      }
      return item
    })
  }

  if (result.list.length > 0) {
    if (result.list[0].cfmFlag !== 'Y') {
      purFlagList.value = true
    } else {
      purFlagList.value = false
    }
    FullCodeUsageDataMethodsParms.value.styleColor = result.list[0].styleColor
    FullCodeUsageCheckMethodsParms.value.styleColor = result.list[0].styleColor
    ubdateSizeNoMethodsParms.value.styleColor = result.list[0].styleColor
    saveDateListMethodsParms.value.styleColor = result.list[0].styleColor   
    UsageChangeQueryMethodsParms.value.styleColor = result.list[0].styleColor
    UsageChangeQueryMethodsParms.value.colorCode = result.list[0].colorCode
    UsageChangeQueryMethodsParms.value.orderId = result.list[0].orderId
    saveDateListMethodsParms.value.styleColorRemark = result.list[0].remark
    CopyDataMethodsPamrs.value.styleColor = result.list[0].styleColor
    CopyDataMethodsPamrs.value.colorCode = result.list[0].colorCode
    SelectTheCurrentRowToInsertMethodsParms.value.styleColor = result.list[0].styleColor
    ProductionOfOfficialMaterialsMethodsParms.value.styleColor = result.list[0].styleColor
    InsertTheBondingMaterialMethodsListAParms.value.styleColor = result.list[0].styleColor
    BondingMaterialTreatmentParms.value.styleColor = result.list[0].styleColor
    copyDataParms.value.styleColor = result.list[0].styleColor
    image.value = result.list[0].photoPath
    formList2.value[11].inputValue = result.list[0].remark
    imgList.value[0] = result.list[0].photoPath
    styleNoParms.value.styleColor = result.list[0].styleColor
    styleNoParms.value.cfmFlag = result.list[0].cfmFlag
    styleNoParms.value.orderId = result.list[0].orderId
    CopyDataMethodsPamrs.value.orderId = result.list[0].orderId
    TypeColorDataQueryMethods()

    TypeQueryMethodsPamrs1.value.color = result.list[0].styleColor
    TypeQueryMethodsPamrs1.value.colorCode = result.list[0].colorCode
  }
  // total.value = result.total!
  isLoading15.value = false
}

const total = ref(0)

const handleSizeChange = (val: number) => {
  ColorCodePictureMethodsParms.value.pageSize = val
  ColorCodePictureMethods()
}

const handleCurrentChange = (val: number) => {
  ColorCodePictureMethodsParms.value.pageNum = val
  ColorCodePictureMethods()
}

// 型体
const isLoading11 = ref(true)

const Launchform = (row: any) => {
  TypeQueryMethodsPamrs.value.styleNo = row[0].inputValue
  listAddParms.value.styleNo = row[0].inputValue
  ColorCodePictureMethodsParms.value.styleNo = row[0].inputValue

  TypeQueryMethodsPamrs1.value.style = row[0].inputValue
}

// 颜色代码更新
const ColorCodeQueryMethodsParms = ref<ColorCodePictureParms>({
  colorCode: '',
  pageNum: 1,
  pageSize: 40,
  styleColor: '',
  styleNo: ''
})

const ColorCodeUpdateMethods = async () => {
  try {
    const result = await LoginWork.post<any, any>(`/developmentUsage/ColorCodeUpdate?styleNo=${ColorCodeQueryMethodsParms.value.styleNo}`)
    if (result.code === 200) {
      TypeQueryMethods()
      JMessage.success(result.msg)
    } else {
      JMessage.warning(result.msg)
    }
  } catch (error) {
    JMessage.error('颜色代码更新失败请重试')
  }
}

const findClicked = (count: string) => {
  if(count === '注意事项建档'){
    PrecautionsFileMethods()
    dialogVisible.value = true
  }
  if (count === '复制资料') {
    dialogVisible1.value = true
  }
  if (count === '颜色代码更新') {
    ColorCodeUpdateMethods()
  }
  if (count === '新增') {
    AllSizeNo126.value = true
    // if (ColorCodePictureMethodsParms.value.styleColor === '' || ColorCodePictureMethodsParms.value.styleNo === '') {
    //   JMessage.warning('型体颜色名称颜色代号都不可为空')
    // } else {
    //   listAdd()
    // }
  }
  if (count === '检核') {
    RdTypeBodyFileCheckMethods()
  }
  if (count === '取消检核') {
    RdTypeBodyFileCancelCheckMethods()
  }
  if (count === '保存') {
    saveDateListMethods()
  }
  if (count === '查询') {
    TypeQueryMethods()
  }
  if (count === '置空') {
    clearFormList15()
  }
}

const TypeQueryMethodsPamrs = ref<any>({
  colorCode: '',
  pageNum: 1,
  pageSize: 40,
  styleColor: '',
  styleNo: '',
  orderId:''
})

const TypeQueryMethodsPamrs1 = ref<any>({
  colorCode: '',
  pageNum: 1,
  pageSize: 40,
  color: '',
  style: ''
})

const TypeQueryMethodsTableDateList = ref([])

const TypeQueryMethods = async () => {
  isLoading11.value = true
  const result = await TypeQuery(TypeQueryMethodsPamrs.value)

  if (result.rows !== null) {
    if (result.rows.length > 0) { 
      TypeQueryMethodsTableDateList.value = result.rows.map((item:any) => { 
        item.photoPath = Object.values(result.files).find((item1:any) => {  
    return item1.fileId === item.photoId; // 查找合匹配的 photoId  
        });  
        if(item.cfmFlag !== 'Y'){
          item.functionRow = [ 
          {
            label: '复制资料'
          },
          {
            label: '修改'
          },
          {
            label: '删除'
          },

          ]
        }

      if (item.cfmFlag === 'Y') {
        item.backgroundColor = '#80FF00'
      }
        return item
      })

      imgList3.value = result.rows.map((item:any) => {
    const {buckName,fileName} = item.photoPath
     return {buckName,fileName}
 })
  await Promise.all(
    TypeQueryMethodsTableDateList.value.map(async (item:any) => {
        const result = await service.get<any, any>(`/file/oss/view/${item.photoPath.buckName}/${item.photoPath.fileName}`);
        item.photoPath = 'data:image/png;base64,'+result.data
        return 'data:image/png;base64,'+result.data
      })
    );
    imgList3.value = await Promise.all(  
      imgList3.value.map(async (item:any) => {  
        const result = await service.get<any, any>(`/file/oss/view/${item.buckName}/${item.fileName}`);  
        return 'data:image/png;base64,'+result.data
      })  
    );  
    UsageChangeQueryMethodsParms.value.orderId = result.rows[0].orderId
    UsageChangeQueryMethodsParms.value.styleColor = result.rows[0].styleColor
    UsageChangeQueryMethodsParms.value.styleNo = result.rows[0].styleNo
      // ColorCodePictureMethodsParms.value.styleNo = result.list[0]
      // TypeColorDataQueryMethodsPamrs.value.styleNo = result.list[0]
      // FullCodeUsageDataMethodsParms.value.styleNo = result.list[0]
      // FullCodeUsageCheckMethodsParms.value.styleNo = result.list[0]
      // saveDateListMethodsParms.value.styleNo = result.list[0]
      // UsageChangeQueryMethodsParms.value.styleNo = result.list[0]
      // CopyDataMethodsPamrs.value.styleNo = result.list[0]
      // SelectTheCurrentRowToInsertMethodsParms.value.styleNo = result.list[0]
      // ProductionOfOfficialMaterialsMethodsParms.value.styleNo = result.list[0]
      // InsertTheBondingMaterialMethodsListAParms.value.styleNo = result.list[0]
      // TypeQueryMethodsPamrs1.value.style = result.list[0]
      // BondingMaterialTreatmentParms.value.styleNo = result.list[0]
      // copyDataParms.value.styleNo = result.list[0]
      // ColorCodeQueryMethodsParms.value.styleNo = result.list[0]
      // styleNoParms.value.styleNo = result.list[0]

      // ubdateSizeNoMethodsParms.value.styleNo = result.list[0]

      // ColorCodePictureMethods()
    } else {
      TypeQueryMethodsTableDateList.value = []
    }
  } else {
    JMessage.error(result.msg)
  }

  totalTk.value = result.total
  isLoading11.value = false
}

const totalTk = ref(0)

const handleSizeChangeTk = (val: number) => {
  TypeQueryMethodsPamrs.value.pageSize = val
  TypeQueryMethods()
}

const handleCurrentChangeTk = (val: number) => {
  TypeQueryMethodsPamrs.value.pageNum = val
  TypeQueryMethods()
}

// 统一调用接口
const interAceFunct = () => {
  // 选择型体
  TypeQueryMethods()

  // GetVendorListMethods()
}
const tokenList = ref<any>('')
onMounted(() => {
  interAceFunct()
  RdTypeBodyFilePositionListMethods()

  const token = sessionStorage.getItem('Authorization')
  tokenList.value = token
})

const listAddParms = ref<any>({
  orderId: '',
  styleColor: '',
  styleNo: ''
})

interface listAddParmsList {
  colorCode: string | null
  styleColor: string
  styleNo: string
}

// 左侧表格数据
const tableHeader = ref([
  {
    label: '型体',
    prop: 'styleNo',
    backgroundColor: true
  },
  {
    label: '型体颜色',
    prop: 'styleColor',
    change: true,
  },

  {
    label: '订单号',
    prop: 'orderId',
    change: true,
  },
  // {
  //   label: '检核标记',
  //   prop: 'cfmFlag',
  //   change: true,
  // },


  // {
  //   label: '检核人',
  //   prop: 'cfmUser',
  //   change: true
  // },
  {
    label: '样品类型',
    prop: 'sampleType',
    change: true
  },
  {
    label: '基本码',
    prop: 'sizeNo',
    change: true
  },
  {
    label: '颜色代码',
    prop: 'colorCode',
    change: true
  },
  {
    width: 140,
    type: 'img',
    label: '图片',
    fixed: true,
    prop: 'photoPath',
    srcList: imgList3
  },
  {
    label: '备注',
    prop: 'remark',
    change: true
  },
  {
    label: '操作',
    prop: 'outSum',
    type: 'functionRow',
    width: '300px',
  }
])

const tableHeader20 = ref([
  {
    label: '型体',
    prop: 'styleNo',
    backgroundColor: true
  },
  {
    label: '型体颜色',
    prop: 'styleColor',
    change: true,
  },

  {
    label: '订单号',
    prop: 'orderId',
    change: true,
  },
  // {
  //   label: '检核标记',
  //   prop: 'cfmFlag',
  //   change: true,
  // },


  // {
  //   label: '检核人',
  //   prop: 'cfmUser',
  //   change: true
  // },
  {
    label: '样品类型',
    prop: 'sampleType',
    change: true
  },
  {
    label: '颜色代码',
    prop: 'colorCode',
    change: true
  },
])


const tableHeader2 = ref([

  // {
  //   label: '图片', fixed: true,
  //   prop: "photoPath",
  //   width: '80',
  //   type: 'img',
  //   srcList: imgList
  // },
])

const tableHeader3 = ref([
  {
    label: '序号',
    prop: 'seqNo',
    width: '50',
    change: true
  },
  {
    label: '部位   ',
    width: '100',
    prop: 'partName'
  },
  {
    label: '分段',
    prop: 'segment',
    width: '50',
    change: true
  },
  {
    label: '物料编码',
    prop: 'mtlNo',
    width: '100'
  },
  {
    label: '材料颜色',
    prop: 'mtlColor',
    change: true,
    width: '200'
  },
  {
    start: true,
    label: '材料名称',
    prop: 'mtlName',
    change: true
  },
  {
    label: '规格',
    prop: 'mtlSpec',
    width: '50',
    change: true
  },
  {
    label: '单位',
    prop: 'mtlUnit',
    width: '50',
    change: true
  },
  // {
  //   label: '尺码起',
  //   prop: 'size1',
  //   width: '50',
  // },
  // {
  //   label: '尺码止',
  //   prop: 'size2',
  //   width: '50',
  // },
  {
    label: '供应商 ',
    prop: 'vendor',
    width: '50'
  },
  // {
  //   label: '用量',
  //   prop: 'usage',
  //   width: '60',
  // },
  // {
  //   label: '计算方式',
  //   prop: 'usageType',
  //   width: '100',
  //   type: 'select',
  //   disable: true,
  // },
  // {
  //   label: '领用单位',
  //   prop: 'drawDept',
  //   width: '50',
  //   type: 'select',
  //   disable: true,
  // },
  // {
  //   label: '号码类型',
  //   prop: 'sizeType',
  //   width: '50',
  //   type: 'select',
  //   disable: true,
  // },
  {
    type: 'checkbox',
    label: '是否测试"',
    prop: 'isTest',
    width: 60
  },
  // {
  //   label: '捡料',
  //   prop: 'noLotUsage',
  //   type: 'checkbox',
  //   width: '50',
  // },
  {
    label: '备注',
    prop: 'remark',
    width: '100'
  },
  {
    label: '供货方式',
    prop: 'vendorType',
    width: '100'
  },
  {
    label: '联系方式',
    prop: 'phone',
    width: '100'
  },
  {
    label: '部件加工方式',
    prop: 'process',
    width: '100'
  },
])



const tableHeader5 = ref([
  {
    label: '物料编码',
    prop: 'mtlNo',
    width: '80',
    change: true
  },
  {
    label: '材料颜色',
    width: '80',
    prop: 'mtlColor',
    change: true
  },
  {
    label: '材料名称',
    prop: 'mtlName',
    change: true
  },
  {
    label: '规格',
    prop: 'mtlSpec',
    change: true
  },
  {
    label: '单位',
    prop: 'mtlUnit',
    change: true
  },
  {
    label: '加工方式',
    prop: 'prdType',
    change: true
  },
  {
    label: '供应商',
    prop: 'vendor',
    change: true
  },
  {
    label: '比例',
    prop: 'percent'
  },
  {
    label: '是否请购',
    prop: 'purFlag',
    type: 'checkbox'
  }
])

const tableHeader7 = ref([
  {
    label: '号码',
    prop: 'sizeFrom'
  },
  {
    label: '用量',
    prop: 'mtlUsage'
  }
])

const tableHeaderStyleNo = ref([
  {
    label: '颜色名称',
    prop: 'styleColor'
  },
  {
    label: '颜色代码',
    prop: 'colorCode'
  },
  {
    label: '订单号',
    prop: 'orderId'
  },
  {
    label: '型体',
    prop: 'style'
  },
  {
    label: '号码',
    prop: 'sizeNo'
  },
  {
    label: '样品类型',
    prop: 'sampleType'
  }
])

const tableHeaderStyleNo1 = ref([
  {
    label: '颜色名称',
    prop: 'styleColor'
  },
  {
    label: '颜色代码',
    prop: 'colorCode'
  },
  {
    label: '订单号',
    prop: 'orderId'
  },
  {
    label: '型体',
    prop: 'style'
  },
  {
    label: '号码',
    prop: 'sizeNo'
  },
  {
    label: '样品类型',
    prop: 'sampleType'
  }
])

const tableHeaderStyleNo12 = ref([
  {
    label: '部位',
    prop: 'partName'
  },
])

const tableHeader8 = ref([
  {
    label: '型体',
    prop: 'styleNo'
  },
  {
    label: '颜色',
    prop: 'styleColor'
  },
  {
    label: '序号',
    prop: 'seqNo'
  },
  {
    label: '部位',
    prop: 'partName'
  },
  {
    label: '分段',
    prop: 'segment'
  },
  {
    label: '物料编码',
    prop: 'mtlNo'
  },
  {
    label: '材料颜色',
    prop: 'mtlColor'
  },
  {
    label: '材料名称',
    prop: 'mtlName'
  },
  {
    label: '规格',
    prop: 'mtlSpec'
  },
  {
    label: '单位',
    prop: 'mtlUnit'
  },
  {
    label: '尺码起',
    prop: 'size1'
  },
  {
    label: '尺码止',
    prop: 'size2'
  },
  {
    label: '供应商',
    prop: 'vendor'
  },
  {
    label: '用量',
    prop: 'usage'
  },
  {
    label: '计算方式',
    prop: 'usageType'
  },
  {
    label: '领用单位',
    prop: 'drawDept'
  },
  {
    label: '号码类型',
    prop: 'sizeType'
  },
  {
    label: '主辅料',
    prop: 'mtlProperty'
  },
  {
    label: '捡料',
    prop: 'noLotUsage',
    type: 'checkbox'
  },
  {
    label: '备注',
    prop: 'remark'
  }
])

const tableHeader9 = ref([
  {
    label: '号码',
    prop: 'sizeFrom'
  },
  {
    label: '用量',
    prop: 'mtlUsage'
  }
])

const tableHeader10 = ref([
  {
    label: '部位',
    prop: 'partName',
    width: '50'
  },
  {
    label: '分段',
    prop: 'segment',
    width: '60'
  },
  {
    label: '变更类型',
    prop: 'changeType',
    width: '90'
  },
  {
    label: '变更内容',
    prop: 'remark'
  },
  {
    label: '操作时间',
    prop: 'sysDate',
    width: '150'
  },
  {
    label: '操作员',
    prop: 'sysUser',
    width: '60'
  }
])

const tableHeader11 = ref([
  {
    label: '序号',
    prop: 'seqNo',
    width: '50',
    change: true
  },
  {
    label: '事项名称',
    prop: 'seqName',
    change: true
  },
  {
    label: '注意事项',
    prop: 'prodMemo'
  }
])

const tableHeader12 = ref([
  {
    label: '物料编码',
    prop: 'mtlNo'
  },
  {
    label: '材料颜色',
    prop: 'mtlColor'
  },
  {
    label: '材料名称',
    prop: 'mtlName',
    width: '300'
  },
  {
    label: '规格',
    prop: 'mtlSpec'
  },
  {
    label: '单位',
    prop: 'mtlUnit'
  },
  {
    label: '供应商',
    prop: 'vendor'
  }
])

const tableHeader13 = ref([
  {
    label: '物料编码',
    prop: 'mtlNo'
  },
  {
    label: '材料名称',
    prop: 'mtlName',
    width: '300'
  },
  {
    label: '规格',
    prop: 'mtlSpec'
  },
  {
    label: '单位',
    prop: 'mtlUnit'
  },
  {
    label: '供应商',
    prop: 'vendor'
  }
])

const tableHeader15 = ref([
  {
    label: '色系',
    prop: 'colorSystem'
  },
  {
    label: '颜色',
    prop: 'colorName'
  },
  {
    label: 'PANTONE',
    prop: 'pantone'
  },
  {
    label: '颜色(英)',
    prop: 'engColor'
  }
])

const tableHeader16 = ref([
  {
    label: '型体',
    prop: 'styleNo'
  },
  {
    label: '颜色',
    prop: 'styleColor'
  },
  {
    label: '冲刀号(起)',
    prop: 'minCutSize'
  },
  {
    label: '冲刀号(止)',
    prop: 'maxCutSize'
  }
])

const tableHeader17 = ref([
  {
    label: '物料编码',
    prop: 'mtlNo',
    change: true
  },
  {
    label: '材料颜色 ',
    prop: 'mtlColor'
  },
  {
    label: '材料名称',
    prop: 'mtlName',
    change: true
  },
  {
    label: '规格',
    prop: 'mtlSpec',
    change: true
  },
  {
    label: '单位',
    prop: 'mtlUnit',
    change: true
  },
  {
    label: '加工方式',
    prop: 'prdType',
    type: 'select'
  },
  {
    label: '供应商  ',
    prop: 'vendor',
    type: 'select'
  },
  {
    label: '比例',
    prop: 'percent'
  },
  {
    label: '请购否',
    type: 'checkbox',
    prop: 'purFlag'
  }
])

const tableHeader19 = ref([
  {
    label: '序号',
    prop: 'seqNo',
    change: true,
    width: '90'
  },
  {
    label: '事项名称',
    prop: 'seqName',
    change: true,
    width: '90'
  },
  {
    textarea: true,
    label: '注意事项',
    prop: 'prodMemo'
  },
  {
    label: '操作',
    prop: 'outSum',
    type: 'functionRow',
    width: '100px',
  }
])
</script>
<style lang="less" scoped>
:deep(.el-input__suffix) {
  display: none;
}
.btns {
  display: flex;
  justify-content: space-between;

  .bg {
    background-color: #e7e7e7;
    border: 1px solid #e7e7e7;
    color: #000000;
  }
}

.mt10 {
  width: 20%;
}

.mt24 {
  margin-top: 10px;
}

h1 {
  font-size: 16px;
}

// 圆的改成方的
:deep(.el-radio__inner) {
  border: 1px solid #dcdfe6;
  border-radius: 2px;
  width: 14px;
  height: 14px;
  background-color: #fff;
  cursor: pointer;
  box-sizing: border-box;
}

// 文字和单选之间的距离
:deep(.el-radio__label) {
  padding-left: 5px;
}

// 选中状态改变成对钩
:deep(.el-radio__input.is-checked .el-radio__inner::after) {
  content: '';
  width: 8px;
  height: 5px;
  border: 2px solid white;
  border-top: transparent;
  border-right: transparent;
  text-align: center;
  display: block;
  position: absolute;
  top: 2px;
  left: 2px;
  vertical-align: middle;
  transform: rotate(-45deg);
  border-radius: 0px;
  background: none;
}

:deep(.el-radio__input.is-checked + .el-radio__label) {
  color: #606266;
}

// :deep(.el-input .el-input--small .el-input--suffix .el-input__inner){
//   height: 100px;
// }
.avatar-uploader111 .avatar {
  width: 178px;
  height: 178px;
  display: block;
}
</style>

<style>
.avatar-uploader111 .el-upload {
  border: 1px dashed var(--el-border-color);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--el-transition-duration-fast);
}

.avatar-uploader111 .el-upload:hover {
  border-color: var(--el-color-primary);
}

.el-icon.avatar-uploader-icon111 {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
}

.avatar111{
  width: 178px;
  height: 178px;
}
</style>
